On Sat 25-10-25 11:21:57, libaokun@huaweicloud.com wrote:
> From: Zhihao Cheng <chengzhihao1@huawei.com>
>
> 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>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/inode.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index e99306a8f47c..0742039c53a7 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4157,9 +4157,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
> --
> 2.46.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR