Skip to content
/ linux Public

Commit ceee57f

Browse files
gouhao2025gregkh
authored andcommitted
ext4: delete redundant calculations in ext4_mb_get_buddy_page_lock()
[ Upstream commit f2fec3e ] 'blocks_per_page' is always 1 after 'if (blocks_per_page >= 2)', 'pnum' and 'block' are equal in this case. Signed-off-by: Gou Hao <gouhao@uniontech.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20231024035215.29474-1-gouhao@uniontech.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Stable-dep-of: bdc56a9 ("ext4: fix e4b bitmap inconsistency reports") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 31c4c67 commit ceee57f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/ext4/mballoc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,9 +1486,8 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
14861486
return 0;
14871487
}
14881488

1489-
block++;
1490-
pnum = block / blocks_per_page;
1491-
page = find_or_create_page(inode->i_mapping, pnum, gfp);
1489+
/* blocks_per_page == 1, hence we need another page for the buddy */
1490+
page = find_or_create_page(inode->i_mapping, block + 1, gfp);
14921491
if (!page)
14931492
return -ENOMEM;
14941493
BUG_ON(page->mapping != inode->i_mapping);

0 commit comments

Comments
 (0)