From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: David Howells <dhowells@redhat.com>, Jeff Layton <jlayton@kernel.org>
Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org,
linux-cachefs@redhat.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] fscache,cachefiles: add prepare_ondemand_read() callback
Date: Thu, 17 Nov 2022 12:24:40 +0800 [thread overview]
Message-ID: <c529ee21-699d-dfc8-5f7d-2597fa00796d@linux.alibaba.com> (raw)
In-Reply-To: <2968419.1668606101@warthog.procyon.org.uk>
On 11/16/22 9:41 PM, David Howells wrote:
> Jeff Layton <jlayton@kernel.org> wrote:
>
>>> +static enum netfs_io_source cachefiles_do_prepare_read(struct netfs_cache_resources *cres,
>>> + loff_t *_start, size_t *_len,
>>> + unsigned long *_flags, loff_t i_size)
>>
>> _start is never changed, so it should be passed by value instead of by
>> pointer.
>
> Hmmm. The intention was that the start pointer should be able to be moved
> backwards by the cache - but that's not necessary in ->prepare_read() and
> ->expand_readahead() is provided for that now. So yes, the start pointer
> shouldn't get changed at this point.
Okay.
>
>> I'd also reverse the position of the arguments for _flags and i_size.
>> Otherwise, the CPU/compiler have to shuffle things around more in
>> cachefiles_prepare_ondemand_read before they call this.
>
> Better to pass the flags in and then ignore them. That way it can tail call,
> or just call cachefiles_do_prepare_read() directly from erofs. If you're
> going to have a wrapper, then you might be just as well create a
> netfs_io_subrequest struct on the stack.
I would prefer letting cachefiles_prepare_ondemand_read() pass flags in
and then tail call cachefiles_do_prepare_read() directly.
Many thanks for the suggestion.
--
Thanks,
Jingbo
next prev parent reply other threads:[~2022-11-17 4:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 10:45 [PATCH v3 0/2] fscache,cachefiles: add prepare_ondemand_read() interface Jingbo Xu
2022-11-16 10:45 ` [PATCH v3 1/2] fscache,cachefiles: add prepare_ondemand_read() callback Jingbo Xu
2022-11-16 11:58 ` Jeff Layton
2022-11-16 12:17 ` Jingbo Xu
2022-11-16 13:41 ` David Howells
2022-11-17 4:24 ` Jingbo Xu [this message]
2022-11-16 10:45 ` [PATCH v3 2/2] erofs: switch to prepare_ondemand_read() in fscache mode Jingbo Xu
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=c529ee21-699d-dfc8-5f7d-2597fa00796d@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=dhowells@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-cachefs@redhat.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox