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 <allan@klarasystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #17113
(cherry picked from commit 09f4dd06c3)
This commit is contained in:
Alexander Motin
2025-03-13 13:27:15 -04:00
committed by Tony Hutter
parent 588fa16830
commit 602fecc316
3 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -2006,8 +2006,7 @@ zio_write_compress(zio_t *zio)
compress = ZIO_COMPRESS_OFF;
if (cabd != NULL)
abd_free(cabd);
} else if (!zp->zp_dedup && !zp->zp_encrypt &&
psize <= BPE_PAYLOAD_SIZE &&
} else if (psize <= BPE_PAYLOAD_SIZE && !zp->zp_encrypt &&
zp->zp_level == 0 && !DMU_OT_HAS_FILL(zp->zp_type) &&
spa_feature_is_enabled(spa, SPA_FEATURE_EMBEDDED_DATA)) {
void *cbuf = abd_borrow_buf_copy(cabd, lsize);