summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorGou Hao <gouhao@uniontech.com>2023-10-24 11:52:15 +0800
committerTheodore Ts'o <tytso@mit.edu>2024-01-04 23:26:21 -0500
commitf2fec3e99a32d7c14dbf63c824f8286ebc94b18d (patch)
tree1f03a3e773b3fab132f954663e42501d89c203fe /fs/ext4
parent665d3e0af4d35acf9a5f58dfd471bc27dbf55880 (diff)
downloadlinux-f2fec3e99a32d7c14dbf63c824f8286ebc94b18d.tar.gz
linux-f2fec3e99a32d7c14dbf63c824f8286ebc94b18d.tar.bz2
linux-f2fec3e99a32d7c14dbf63c824f8286ebc94b18d.zip
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 <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>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/mballoc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d72b5e3c92ec..847dc0fb1573 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1456,9 +1456,8 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
return 0;
}
- block++;
- pnum = block / blocks_per_page;
- page = find_or_create_page(inode->i_mapping, pnum, gfp);
+ /* blocks_per_page == 1, hence we need another page for the buddy */
+ page = find_or_create_page(inode->i_mapping, block + 1, gfp);
if (!page)
return -ENOMEM;
BUG_ON(page->mapping != inode->i_mapping);