[PATCH] erofs-utils: mkfs: keep one-block uncompressed data for deduplication

Gao Xiang hsiangkao at linux.alibaba.com
Wed Jan 22 03:56:22 AEDT 2025


Otherwise, the deduplication rate will be impacted, but it doesn't
mattersince `-Ededupe` is still single-threaded.

Fixes: 341d23a878a2 ("erofs-utils: mkfs: speed up uncompressed data handling")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/compress.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/compress.c b/lib/compress.c
index 5c9c051..604a04c 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;
 		}
-- 
2.43.5



More information about the Linux-erofs mailing list