From 35ecc72a445b04f2a257bc31cbeb310d76420b89 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Wed, 26 Jul 2023 15:10:11 +1000 Subject: [PATCH] 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 --- e2fsck/pass1.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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; -- 1.8.3.1