Skip to content

Commit 09f4dd0

Browse files
authored
Prefer embedded blocks to dedup
Since embedded blocks introduction 11 years ago, their writing was blocked if dedup is enabled. After searching through the modern code I see no reason for this restriction to exist. Same time embedded blocks are dramatically cheaper. Even regular write of so small blocks would likely be cheaper than deduplication, even if the last is successful, not mentioning otherwise. Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes openzfs#17113
1 parent 13ec35c commit 09f4dd0

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

module/zfs/zio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,8 +2005,7 @@ zio_write_compress(zio_t *zio)
20052005
compress = ZIO_COMPRESS_OFF;
20062006
if (cabd != NULL)
20072007
abd_free(cabd);
2008-
} else if (!zp->zp_dedup && !zp->zp_encrypt &&
2009-
psize <= BPE_PAYLOAD_SIZE &&
2008+
} else if (psize <= BPE_PAYLOAD_SIZE && !zp->zp_encrypt &&
20102009
zp->zp_level == 0 && !DMU_OT_HAS_FILL(zp->zp_type) &&
20112010
spa_feature_is_enabled(spa, SPA_FEATURE_EMBEDDED_DATA)) {
20122011
void *cbuf = abd_borrow_buf_copy(cabd, lsize);

tests/zfs-tests/tests/functional/cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ log_must zpool prefetch -t ddt $TESTPOOL
7575
# to generate a reasonable size DDT for testing purposes.
7676

7777
DATASET=$TESTPOOL/ddt
78-
log_must zfs create -o dedup=on $DATASET
78+
log_must zfs create -o compression=off -o dedup=on $DATASET
7979
MNTPOINT=$(get_prop mountpoint $TESTPOOL/ddt)
8080

8181
log_note "Generating dataset ..."

tests/zfs-tests/tests/functional/dedup/dedup_quota.ksh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function do_setup
7979
log_must truncate -s 5G $VDEV_GENERAL
8080
# Use 'xattr=sa' to prevent selinux xattrs influencing our accounting
8181
log_must zpool create -o ashift=12 -f -O xattr=sa -m $MOUNTDIR $POOL $VDEV_GENERAL
82-
log_must zfs set dedup=on $POOL
82+
log_must zfs set compression=off dedup=on $POOL
8383
log_must set_tunable32 TXG_TIMEOUT 600
8484
}
8585

0 commit comments

Comments
 (0)