Skip to content

Commit

Permalink
erofs-utils: mkfs: fix -Eall-fragments for multi-threaded compression
Browse files Browse the repository at this point in the history
`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: 882ad1c ("erofs-utils: mkfs: fix `-Eall-fragments` for multi-threaded compression")
Fixes: 10c1590 ("erofs-utils: enable multi-threaded support for `-Eall-fragments`")
Signed-off-by: Gao Xiang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
hsiangkao committed Jan 2, 2025
1 parent 5aa3685 commit 04d6d5a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 04d6d5a

Please sign in to comment.