erofs-utils: lib: only apply `fix_dedupedfrag` to the last segment
PATCH 1/4 erofs-utils: lib: only apply `fix_dedupedfrag` to the last segment
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(-)
lib/compress.c +2 -1
@@ -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 ;
Signature · 1 line
2.43.5
PATCH 2/4 erofs-utils: lib: drop unused `ret` assignment
Coverity-id: 548921
Signed-off-by Gao Xiang <[email protected]>
--- lib/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/compress.c +1 -1
@@ -1202,7 +1202,7 @@ int erofs_commit_compressed_file(struct z_erofs_compress_ictx *ictx, }if (ptotal) { - ret =erofs_bh_balloon (bh, ptotal); + (void )erofs_bh_balloon (bh, ptotal); }else {if (!cfg.c_fragments && !cfg.c_dedupe)DBG_BUGON (!inode->idata_size);
Signature · 1 line
2.43.5
PATCH 3/4 erofs-utils: lib: fix an API usage error
In reply to Gao XiangCoverity-id: 548920
Signed-off-by Gao Xiang <[email protected]>
--- lib/compress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/compress.c +2 -2
@@ -1208,8 +1208,8 @@ int erofs_commit_compressed_file(struct z_erofs_compress_ictx *ictx,DBG_BUGON (!inode->idata_size); } -erofs_info ("compressed %s (%llu bytes) into %u bytes" , - inode->i_srcpath, inode->i_size |0ULL , ptotal); +erofs_info ("compressed %s (%llu bytes) into %llu bytes" , + inode->i_srcpath, inode->i_size |0ULL , ptotal |0ULL );if (inode->idata_size) { bh->op = &erofs_skip_write_bhops;
Signature · 1 line
2.43.5
PATCH 4/4 erofs-utils: lib: fix two integer handling issues
In reply to Gao XiangCoverity-id: 548918
Coverity-id: 548919
Signed-off-by Gao Xiang <[email protected]>
--- lib/compress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/compress.c +2 -2
@@ -1169,7 +1169,7 @@ int erofs_commit_compressed_file(struct z_erofs_compress_ictx *ictx,/* fall back to no compression mode */ DBG_BUGON (pstart < (!!inode->idata_size) << bbits); - ptotal -= (!!inode->idata_size) << bbits; + ptotal -= (u64)(!!inode->idata_size) << bbits; compressmeta =z_erofs_write_indexes (ictx);if (!compressmeta) {
@@ -1687,7 +1687,7 @@ int erofs_write_compressed_file(struct z_erofs_compress_ictx *ictx) ret =PTR_ERR (bh); goto err_free_idata; } - pstart =erofs_mapbh (NULL , bh->block) << sbi->blkszbits; + pstart =erofs_pos (sbi,erofs_mapbh (NULL , bh->block)); ictx->seg_num =1 ; sctx = (struct z_erofs_compress_sctx ) {
Signature · 1 line
2.43.5