mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-06-25 02:28:01 +03:00
Allow zero compression if dedup is enabled
Having high-refcount dedup entries for zero blocks is inefficient when they could be recorded as a holes instead. Normally, zero compression is not done if compression is disabled to not confuse naive benchmarks. But with dedup enabled, it is expected that the write will be skipped anyway, so we are just optimizing the way it is skipped. Reviewed-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #17435
This commit is contained in:
parent
0e9e2e2501
commit
bcd0430236
@ -2422,6 +2422,15 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
|
||||
complevel = zio_complevel_select(os->os_spa, compress,
|
||||
complevel, complevel);
|
||||
|
||||
/*
|
||||
* Storing many references to an all zeros block in the dedup
|
||||
* table would be expensive. Instead, if dedup is enabled,
|
||||
* store them as holes even if compression is not enabled.
|
||||
*/
|
||||
if (compress == ZIO_COMPRESS_OFF &&
|
||||
dedup_checksum != ZIO_CHECKSUM_OFF)
|
||||
compress = ZIO_COMPRESS_EMPTY;
|
||||
|
||||
checksum = (dedup_checksum == ZIO_CHECKSUM_OFF) ?
|
||||
zio_checksum_select(dn->dn_checksum, checksum) :
|
||||
dedup_checksum;
|
||||
|
Loading…
Reference in New Issue
Block a user