mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 00:54:41 +08:00
ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple
We try to allocate a block from goal in ext4_mb_new_blocks_simple. We only need get blkoff in first group with goal and set blkoff to 0 for the rest groups. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Link: https://lore.kernel.org/r/20230303172120.3800725-21-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
46825e9490
commit
253cacb0de
@ -5773,9 +5773,6 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ext4_get_group_no_and_offset(sb,
|
||||
max(ext4_group_first_block_no(sb, group), goal),
|
||||
NULL, &blkoff);
|
||||
while (1) {
|
||||
i = mb_find_next_zero_bit(bitmap_bh->b_data, max,
|
||||
blkoff);
|
||||
@ -5790,6 +5787,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle,
|
||||
brelse(bitmap_bh);
|
||||
if (i < max)
|
||||
break;
|
||||
|
||||
blkoff = 0;
|
||||
}
|
||||
|
||||
if (group >= ext4_get_groups_count(sb) || i >= max) {
|
||||
|
Loading…
Reference in New Issue
Block a user