From: Li Dongyang Date: Wed, 26 Jul 2023 05:10:11 +0000 (+1000) Subject: LU-16972 e2fsck: fix merging ea_inode_refs X-Git-Tag: 1.47.0-wc4~5 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F51763%2F2;p=tools%2Fe2fsprogs.git LU-16972 e2fsck: fix merging ea_inode_refs ea_inode_refs is used to track refs to ea inodes, which has nothing to do with blocks. Change-Id: Icd965a8e3a92edc51754c132b55044af9abbb9e4 Signed-off-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/c/tools/e2fsprogs/+/51763 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 66f0e9c..9e49407 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -3195,8 +3195,8 @@ static errcode_t e2fsck_pass1_merge_dirs_to_hash(e2fsck_t global_ctx, static errcode_t e2fsck_pass1_merge_ea_inode_refs(e2fsck_t global_ctx, e2fsck_t thread_ctx) { - ea_value_t count; - blk64_t blk; + ea_value_t thread_count, global_count; + ea_key_t ino; errcode_t retval; if (!thread_ctx->ea_inode_refs) @@ -3210,17 +3210,15 @@ static errcode_t e2fsck_pass1_merge_ea_inode_refs(e2fsck_t global_ctx, ea_refcount_intr_begin(thread_ctx->ea_inode_refs); while (1) { - if ((blk = ea_refcount_intr_next(thread_ctx->ea_inode_refs, - &count)) == 0) + if ((ino = ea_refcount_intr_next(thread_ctx->ea_inode_refs, + &thread_count)) == 0) break; - if (!global_ctx->block_ea_map || - !ext2fs_fast_test_block_bitmap2(global_ctx->block_ea_map, - blk)) { - retval = ea_refcount_store(global_ctx->ea_inode_refs, - blk, count); - if (retval) - return retval; - } + ea_refcount_fetch(global_ctx->ea_inode_refs, + ino, &global_count); + retval = ea_refcount_store(global_ctx->ea_inode_refs, + ino, thread_count + global_count); + if (retval) + return retval; } return retval;