summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2025-11-21 17:06:31 +0800
committerTheodore Ts'o <tytso@mit.edu>2025-11-28 22:35:26 -0500
commit5835b1339e33549d9e7342fae56243b4fcd758c9 (patch)
treeb01872d1a5f03a3c2fc4211abfc8461305405e47 /fs/ext4
parent7c11c56eb32eae96893eebafdbe3decadefe88ad (diff)
downloadlinux-5835b1339e33549d9e7342fae56243b4fcd758c9.tar.gz
linux-5835b1339e33549d9e7342fae56243b4fcd758c9.tar.bz2
linux-5835b1339e33549d9e7342fae56243b4fcd758c9.zip
ext4: remove page offset calculation in ext4_block_zero_page_range()
For bs <= ps scenarios, calculating the offset within the block is sufficient. For bs > ps, an initial page offset calculation can lead to incorrect behavior. Thus this redundant calculation has been removed. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Message-ID: <20251121090654.631996-2-libaokun@huaweicloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8e694c56d3b6..4afe227fd03f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4167,9 +4167,8 @@ static int ext4_block_zero_page_range(handle_t *handle,
struct address_space *mapping, loff_t from, loff_t length)
{
struct inode *inode = mapping->host;
- unsigned offset = from & (PAGE_SIZE-1);
unsigned blocksize = inode->i_sb->s_blocksize;
- unsigned max = blocksize - (offset & (blocksize - 1));
+ unsigned int max = blocksize - (from & (blocksize - 1));
/*
* correct length if it does not fall between