[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260119082327.2029-1-luochunsheng@ustc.edu>
Date: Mon, 19 Jan 2026 16:23:27 +0800
From: Chunsheng Luo <luochunsheng@...c.edu>
To: miklos@...redi.hu
Cc: amir73il@...il.com,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/3] fuse: use offset_in_folio() for large folio offset calculations
On 1/17/26 7:56 AM, Joanne Koong wrote:
> Use offset_in_folio() instead of manually calculating the folio offset.
>
> Signed-off-by: Joanne Koong <joannelkoong@...il.com>
> ---
> fs/fuse/dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 698289b5539e..4dda4e24cc90 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -1812,7 +1812,7 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size,
> if (IS_ERR(folio))
> goto out_iput;
> - folio_offset = ((index - folio->index) << PAGE_SHIFT) + offset;
> + folio_offset = offset_in_folio(folio, outarg.offset);
offset is a loop variable, and later offset maybe set to 0. Replacing it
with outarg.offset here would change the behavior. The same below.
Will this cause any problems?
Thanks,
Chunsheng Luo
> nr_bytes = min_t(unsigned, num, folio_size(folio) - folio_offset);
> nr_pages = DIV_ROUND_UP(offset + nr_bytes, PAGE_SIZE);
> @@ -1916,7 +1916,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
> if (IS_ERR(folio))
> break;
> - folio_offset = ((index - folio->index) << PAGE_SHIFT) + offset;
> + folio_offset = offset_in_folio(folio, outarg->offset);
> nr_bytes = min(folio_size(folio) - folio_offset, num);
> nr_pages = DIV_ROUND_UP(offset + nr_bytes, PAGE_SIZE);
>
Powered by blists - more mailing lists