From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v1 1/3] fuse: use DIV_ROUND_UP() for page count calculations
Date: Thu, 22 Jan 2026 09:49:26 +0800 [thread overview]
Message-ID: <e9bbebb4-83e2-4ded-9def-7ad2fdb54c9e@linux.alibaba.com> (raw)
In-Reply-To: <CAJnrk1Z-cSywcZ+0LyEb_tNWZRTLrHjFMSGSJPzNO4EqK4wozA@mail.gmail.com>
On 1/22/26 5:59 AM, Joanne Koong wrote:
> On Tue, Jan 20, 2026 at 7:21 PM Jingbo Xu <jefflexu@linux.alibaba.com> wrote:
>>
>> Hi Joanne,
>>
>> Thanks for the replying ;)
>>
>> On 1/21/26 4:06 AM, Joanne Koong wrote:
>>> On Tue, Jan 20, 2026 at 11:10 AM Joanne Koong <joannelkoong@gmail.com> wrote:
>>>>
>>>> On Sun, Jan 18, 2026 at 6:12 PM Jingbo Xu <jefflexu@linux.alibaba.com> wrote:
>>>>>
>>>>> On 1/17/26 7:56 AM, Joanne Koong wrote:
>>>>>> Use DIV_ROUND_UP() instead of manually computing round-up division
>>>>>> calculations.
>>>>>>
>>>>>> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
>>>>>> ---
>>>>>> fs/fuse/dev.c | 6 +++---
>>>>>> fs/fuse/file.c | 2 +-
>>>>>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
>>>>>> index 6d59cbc877c6..698289b5539e 100644
>>>>>> --- a/fs/fuse/dev.c
>>>>>> +++ b/fs/fuse/dev.c
>>>>>> @@ -1814,7 +1814,7 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size,
>>>>>>
>>>>>> folio_offset = ((index - folio->index) << PAGE_SHIFT) + offset;
>>>>>> nr_bytes = min_t(unsigned, num, folio_size(folio) - folio_offset);
>>>>>> - nr_pages = (offset + nr_bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
>>>>>> + nr_pages = DIV_ROUND_UP(offset + nr_bytes, PAGE_SIZE);
>>>>>>
>>>>>> err = fuse_copy_folio(cs, &folio, folio_offset, nr_bytes, 0);
>>>>>> if (!folio_test_uptodate(folio) && !err && offset == 0 &&
>>>>>
>>>>> IMHO, could we drop page offset, instead just update the file offset and
>>>>> re-calculate folio index and folio offset for each loop, i.e. something
>>>>> like what [1] did?
>>>>>
>>>>> This could make the code simpler and cleaner.
>>>>
>>>> Hi Jingbo,
>>>>
>>>> I'll break this change out into a separate patch. I agree your
>>>> proposed restructuring of the logic makes it simpler to parse.
>>>>
>>>> Thanks,
>>>> Joanne
>>>>
>>>>>
>>>>> BTW, it seems that if the grabbed folio is newly created on hand and the
>>>>> range described by the store notify doesn't cover the folio completely,
>>>>> the folio won't be set as Uptodate and thus the written data may be
>>>>> missed? I'm not sure if this is in design.
>>>
>>> (sorry, forgot to respond to this part of your email)
>>>
>>> I think this is intentional. By "thus the written data may be missed",
>>> I think you're talking about the writeback path? My understanding is
>>> it's the dirty bit, not uptodate,
>>
>> Not exactly. What I'm concerned is the uptodate bit.
>>
>> In the case where "the grabbed folio is newly created on hand and the
>> range described by the store notify doesn't cover the folio completely,
>> the folio won't be set as Uptodate", the following read(2) or write(2)
>> on the folio will discard the content already in the folio, instead it
>> triggers .readpage() to fetch data from FUSE server again.
>
> Could you elaborate on why this concerns you? Isn't this necessary
> behavior given that it needs to fetch the parts that the store notify
> didn't cover? Or is your concern that the contents are discarded? But
> the server already has that information stored on their side, so I'm
> not seeing why that's a problem.
>
I'm not thinking it as a problem. As said, I guess it is just a design
constraint for FUSE_NOTIFY_STORE.
Thanks.
--
Thanks,
Jingbo
next prev parent reply other threads:[~2026-01-22 1:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 23:56 [PATCH v1 0/3] fuse: clean up offset and page count calculations Joanne Koong
2026-01-16 23:56 ` [PATCH v1 1/3] fuse: use DIV_ROUND_UP() for " Joanne Koong
2026-01-19 2:12 ` Jingbo Xu
2026-01-20 19:10 ` Joanne Koong
2026-01-20 20:06 ` Joanne Koong
2026-01-21 3:21 ` Jingbo Xu
2026-01-21 21:59 ` Joanne Koong
2026-01-22 1:49 ` Jingbo Xu [this message]
2026-01-16 23:56 ` [PATCH v1 2/3] fuse: use offset_in_folio() for large folio offset calculations Joanne Koong
2026-01-19 4:41 ` Chunsheng Luo
2026-01-20 18:59 ` Joanne Koong
2026-01-19 6:24 ` Chunsheng Luo
2026-01-16 23:56 ` [PATCH v1 3/3] fuse: use offset_in_page() for page " Joanne Koong
2026-01-17 5:03 ` [PATCH v1 0/3] fuse: clean up offset and page count calculations Darrick J. Wong
2026-01-20 19:05 ` Joanne Koong
2026-01-17 7:51 ` Horst Birthelmer
2026-01-20 20:06 ` Joanne Koong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9bbebb4-83e2-4ded-9def-7ad2fdb54c9e@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.