mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-09-21 20:22:13 +08:00
ext4: fix unit mismatch in ext4_mb_new_blocks_simple
[ Upstream commit497885f72d
] 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> Stable-dep-of:3f4830abd2
("ext4: fix potential unnitialized variable") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0d82a01cfa
commit
227a4fa4a0
@ -5874,6 +5874,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
|
|||||||
{
|
{
|
||||||
struct buffer_head *bitmap_bh;
|
struct buffer_head *bitmap_bh;
|
||||||
struct super_block *sb = ar->inode->i_sb;
|
struct super_block *sb = ar->inode->i_sb;
|
||||||
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
||||||
ext4_group_t group;
|
ext4_group_t group;
|
||||||
ext4_grpblk_t blkoff;
|
ext4_grpblk_t blkoff;
|
||||||
ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb);
|
ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb);
|
||||||
@ -5902,7 +5903,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
|
|||||||
if (i >= max)
|
if (i >= max)
|
||||||
break;
|
break;
|
||||||
if (ext4_fc_replay_check_excluded(sb,
|
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;
|
blkoff = i + 1;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
@ -5919,7 +5921,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
|
|||||||
return 0;
|
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);
|
ext4_mb_mark_bb(sb, block, 1, 1);
|
||||||
ar->len = 1;
|
ar->len = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user