diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5 index 9970776f2c32..dc518ffbe0eb 100644 --- a/man/man5/zfs-module-parameters.5 +++ b/man/man5/zfs-module-parameters.5 @@ -2860,11 +2860,13 @@ Default value: \fB5\fR. \fBzfs_unique_ddt_max\fR (ulong) .ad .RS 12n -Max unique refcount=1 entries in bytes. Default value is 128MB. +Max unique refcount=1 entries in bytes. Default value is 0, which is off. +The value needs to be 1024 bytes or higher, otherwise value will get +rejected and defaulted back to off. .sp This value can be changed dynamically. .sp -Default value: \fB134217728\fR. +Default value: \fB0\fR. .RE .sp diff --git a/module/zfs/ddt.c b/module/zfs/ddt.c index 5902a81724fa..0582912ec3bb 100644 --- a/module/zfs/ddt.c +++ b/module/zfs/ddt.c @@ -51,7 +51,7 @@ int zfs_dedup_prefetch = 0; * If more entries are added, old (randomly selected) entries will be evicted. * Assuming each entry is 320bytes, 128MB/320 = 134217728/320 = 419430 entries */ -#define DDT_UNIQUE_MAX_SIZE 134217728 +#define DDT_UNIQUE_MAX_SIZE 0 unsigned long zfs_unique_ddt_max = DDT_UNIQUE_MAX_SIZE; static const ddt_ops_t *ddt_ops[DDT_TYPES] = { @@ -1210,9 +1210,9 @@ ddt_unique_max_size(void) * altered them. */ size = zfs_unique_ddt_max; - if (size == 0) { + if (size < 1024) { cmn_err(CE_NOTE, "Bad value for zfs_unique_ddt_max, value must " - "be greater than zero, resetting it to the default (%d)", + "be greater than 1024 bytes, resetting it to the default (%d)", DDT_UNIQUE_MAX_SIZE); size = zfs_unique_ddt_max = DDT_UNIQUE_MAX_SIZE; } @@ -1265,7 +1265,7 @@ ddt_sync_table(ddt_t *ddt, dmu_tx_t *tx, uint64_t txg) * unique entries they want for their own data, depending on what kind * of writes they are doing. */ - if (ddt_object_exists(ddt, DDT_TYPE_CURRENT, DDT_CLASS_UNIQUE)) { + if (ddt_object_exists(ddt, DDT_TYPE_CURRENT, DDT_CLASS_UNIQUE) && (ddt_unique_max != 0)) { uint64_t count = 0; VERIFY(ddt_object_count(ddt, DDT_TYPE_CURRENT, DDT_CLASS_UNIQUE, &count) == 0); for (int64_t i = 0; i < (int64_t)(count - ddt_unique_max); i++) {