Skip to contentSkip to conversation

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

PATCH New Gao Xiang 1 participant 1 message Jan 21, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: keep one-block uncompressed data for deduplication

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")
---
 lib/compress.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
lib/compress.c +6 -3
index 5c9c051..604a04c 100644
@@ -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;
 		}
Signature · 1 line
2.43.5