Only the segment containing the fragment needs to be fixed.
Fixes: b8cc6a36b560 ("erofs-utils: mkfs: implement multi-threaded fragments")
Signed-off-by: Gao Xiang <[email protected]>
---
lib/compress.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/compress.c b/lib/compress.c
index 5ecb9c8..4b966d8 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -729,6 +729,7 @@ fix_dedupedfrag:
static int z_erofs_compress_one(struct z_erofs_compress_sctx *ctx)
{
struct z_erofs_compress_ictx *ictx = ctx->ictx;
+ bool tsg = ctx->seg_idx + 1 >= ictx->seg_num;
struct z_erofs_extent_item *ei;
while (ctx->tail > ctx->head) {
@@ -753,7 +754,7 @@ static int z_erofs_compress_one(struct
z_erofs_compress_sctx *ctx)
}
ctx->pivot = ei;
- if (ictx->fix_dedupedfrag && !ictx->fragemitted &&
+ if (tsg && ictx->fix_dedupedfrag && !ictx->fragemitted &&
z_erofs_fixup_deduped_fragment(ctx))
break;
--
2.43.5