From: Gao Xiang Date: Tue, 21 Jan 2025 16:56:22 +0000 (+0800) Subject: erofs-utils: mkfs: keep one-block uncompressed data for deduplication X-Git-Tag: accepted/tizen/unified/20250610.081809~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efbc1b1f85757d92284fb4259646160967fb6c5d;p=platform%2Fupstream%2Ferofs-utils.git erofs-utils: mkfs: keep one-block uncompressed data for deduplication Otherwise, the deduplication rate will be impacted, but it doesn't matter since `-Ededupe` is still single-threaded. Fixes: 341d23a878a2 ("erofs-utils: mkfs: speed up uncompressed data handling") Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20250121165622.2095470-1-hsiangkao@linux.alibaba.com --- diff --git a/lib/compress.c b/lib/compress.c index cd6ef2f..1f2807b 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -376,6 +376,7 @@ out: return 0; } +/* TODO: reset clusterofs to 0 if permitted */ static int write_uncompressed_block(struct z_erofs_compress_sctx *ctx, unsigned int len, char *dst) { @@ -616,9 +617,11 @@ static int __z_erofs_compress_one(struct z_erofs_compress_sctx *ctx, may_packing = false; e->length = min_t(u32, e->length, ret); nocompression: - /* TODO: reset clusterofs to 0 if permitted */ - ret = write_uncompressed_extents(ctx, len, - e->length, dst); + if (cfg.c_dedupe) + ret = write_uncompressed_block(ctx, len, dst); + else + ret = write_uncompressed_extents(ctx, len, + e->length, dst); if (ret < 0) return ret; }