Skip to content

Commit f2fec3e

Browse files
Gou Haotytso
authored andcommitted
ext4: delete redundant calculations in ext4_mb_get_buddy_page_lock()
'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 <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 665d3e0 commit f2fec3e

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
@@ -1456,9 +1456,8 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
14561456
return 0;
14571457
}
14581458

1459-
block++;
1460-
pnum = block / blocks_per_page;
1461-
page = find_or_create_page(inode->i_mapping, pnum, gfp);
1459+
/* blocks_per_page == 1, hence we need another page for the buddy */
1460+
page = find_or_create_page(inode->i_mapping, block + 1, gfp);
14621461
if (!page)
14631462
return -ENOMEM;
14641463
BUG_ON(page->mapping != inode->i_mapping);

0 commit comments

Comments
 (0)