The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: dhowells@redhat.com, Jingbo Xu <jefflexu@linux.alibaba.com>,
	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: Wed, 16 Nov 2022 13:41:41 +0000	[thread overview]
Message-ID: <2968419.1668606101@warthog.procyon.org.uk> (raw)
In-Reply-To: <2b595b62f6ecd28298a860fcdc5b4941dcafd9eb.camel@kernel.org>

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.

> 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.

David


  parent reply	other threads:[~2022-11-16 13:43 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 [this message]
2022-11-17  4:24       ` Jingbo Xu
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=2968419.1668606101@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=chao@kernel.org \
    --cc=jefflexu@linux.alibaba.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