Whamcloud - gitweb
LU-16972 e2fsck: fix merging ea_inode_refs 63/51763/2
authorLi Dongyang <dongyangli@ddn.com>
Wed, 26 Jul 2023 05:10:11 +0000 (15:10 +1000)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 7 Aug 2023 14:07:20 +0000 (14:07 +0000)
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 <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/tools/e2fsprogs/+/51763
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
e2fsck/pass1.c

index 66f0e9c..9e49407 100644 (file)
@@ -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;