]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ext4: remove redundant mb_regenerate_buddy()
authorChunguang Xu <brookxu@tencent.com>
Sat, 7 Nov 2020 15:58:12 +0000 (23:58 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 3 Dec 2020 14:42:39 +0000 (09:42 -0500)
After this patch (163a203), if an abnormal bitmap is detected, we
will mark the group as corrupt, and we will not use this group in
the future. Therefore, it should be meaningless to regenerate the
buddy bitmap of this group, It might be better to delete it.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Link: https://lore.kernel.org/r/1604764698-4269-2-git-send-email-brookxu@tencent.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mballoc.c

index 24af9ed5c3e52583461ce834b1da817ac1f829b7..5b745551e7a96a117e7cace9998ef893eab79943 100644 (file)
@@ -822,24 +822,6 @@ void ext4_mb_generate_buddy(struct super_block *sb,
        spin_unlock(&sbi->s_bal_lock);
 }
 
-static void mb_regenerate_buddy(struct ext4_buddy *e4b)
-{
-       int count;
-       int order = 1;
-       void *buddy;
-
-       while ((buddy = mb_find_buddy(e4b, order++, &count))) {
-               ext4_set_bits(buddy, 0, count);
-       }
-       e4b->bd_info->bb_fragments = 0;
-       memset(e4b->bd_info->bb_counters, 0,
-               sizeof(*e4b->bd_info->bb_counters) *
-               (e4b->bd_sb->s_blocksize_bits + 2));
-
-       ext4_mb_generate_buddy(e4b->bd_sb, e4b->bd_buddy,
-               e4b->bd_bitmap, e4b->bd_group);
-}
-
 /* The buddy information is attached the buddy cache inode
  * for convenience. The information regarding each group
  * is loaded via ext4_mb_load_buddy. The information involve
@@ -1512,7 +1494,6 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
                                sb, e4b->bd_group,
                                EXT4_GROUP_INFO_BBITMAP_CORRUPT);
                }
-               mb_regenerate_buddy(e4b);
                goto done;
        }