Skip to content

Commit 5835b13

Browse files
Zhihao Chengtytso
authored andcommitted
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>
1 parent 7c11c56 commit 5835b13

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/ext4/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,9 +4167,8 @@ static int ext4_block_zero_page_range(handle_t *handle,
41674167
struct address_space *mapping, loff_t from, loff_t length)
41684168
{
41694169
struct inode *inode = mapping->host;
4170-
unsigned offset = from & (PAGE_SIZE-1);
41714170
unsigned blocksize = inode->i_sb->s_blocksize;
4172-
unsigned max = blocksize - (offset & (blocksize - 1));
4171+
unsigned int max = blocksize - (from & (blocksize - 1));
41734172

41744173
/*
41754174
* correct length if it does not fall between

0 commit comments

Comments
 (0)