From 04d6d5a84bed58713c9cfff5d135b6d3bf713556 Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Thu, 2 Jan 2025 10:42:25 +0800 Subject: [PATCH] erofs-utils: mkfs: fix `-Eall-fragments` for multi-threaded compression `may_packing` in __z_erofs_compress_one() is still bypassed when multi-threaded compression is enabled, which is unexpected. Furthermore, multi-threaded `-Eall-fragments,ztailpacking` can sometimes corrupt images. Let's fix it. Fixes: 882ad1c3157f ("erofs-utils: mkfs: fix `-Eall-fragments` for multi-threaded compression") Fixes: 10c1590c0920 ("erofs-utils: enable multi-threaded support for `-Eall-fragments`") Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20250102024225.2433419-1-hsiangkao@linux.alibaba.com --- lib/compress.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/compress.c b/lib/compress.c index a18b4b5..0e8faad 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -565,8 +565,7 @@ static int __z_erofs_compress_one(struct z_erofs_compress_sctx *ctx, unsigned int len = ctx->tail - ctx->head; bool is_packed_inode = erofs_is_packed_inode(inode); bool tsg = (ctx->seg_idx + 1 >= ictx->seg_num), final = !ctx->remaining; - bool may_packing = (cfg.c_fragments && tsg && final && - !is_packed_inode && !z_erofs_mt_enabled); + bool may_packing = (cfg.c_fragments && tsg && final && !is_packed_inode); bool may_inline = (cfg.c_ztailpacking && tsg && final && !may_packing); unsigned int compressedsize; int ret; -- 2.34.1