summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2023-06-03 18:03:10 +0300
committerTheodore Ts'o <tytso@mit.edu>2023-06-15 07:02:10 +0300
commit497885f72d930305d8e61b6b616b22b4da1adf90 (patch)
treed7aa7a384f664f3bfa8b67346f0fdb8dba083563 /fs/ext4
parentb3916da0d9636285c8a881802956631f9e2ebb5b (diff)
downloadlinux-497885f72d930305d8e61b6b616b22b4da1adf90.tar.xz
ext4: fix unit mismatch in ext4_mb_new_blocks_simple
The "i" returned from mb_find_next_zero_bit is in cluster unit and we need offset "block" corresponding to "i" in block unit. Convert "i" to block unit to fix the unit mismatch. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Link: https://lore.kernel.org/r/20230603150327.3596033-3-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/mballoc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 7d88f76070be..d8caef7cd9d0 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -6011,6 +6011,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
{
struct buffer_head *bitmap_bh;
struct super_block *sb = ar->inode->i_sb;
+ struct ext4_sb_info *sbi = EXT4_SB(sb);
ext4_group_t group;
ext4_grpblk_t blkoff;
ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb);
@@ -6039,7 +6040,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
if (i >= max)
break;
if (ext4_fc_replay_check_excluded(sb,
- ext4_group_first_block_no(sb, group) + i)) {
+ ext4_group_first_block_no(sb, group) +
+ EXT4_C2B(sbi, i))) {
blkoff = i + 1;
} else
break;
@@ -6056,7 +6058,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
return 0;
}
- block = ext4_group_first_block_no(sb, group) + i;
+ block = ext4_group_first_block_no(sb, group) + EXT4_C2B(sbi, i);
ext4_mb_mark_bb(sb, block, 1, 1);
ar->len = 1;