From: Trond Myklebust <trondmy@kernel.org>
To: Dave Wysochanski <dwysocha@redhat.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
David Howells <dhowells@redhat.com>
Cc: linux-nfs@vger.kernel.org, linux-cachefs@redhat.com,
Benjamin Maynard <benmaynard@google.com>,
Daire Byrne <daire.byrne@gmail.com>
Subject: Re: [PATCH v9 3/5] NFS: Convert buffered read paths to use netfs when fscache is enabled
Date: Thu, 27 Oct 2022 15:16:03 -0400 [thread overview]
Message-ID: <870684b35a45b94c426554a62b63f80f421dbb08.camel@kernel.org> (raw)
In-Reply-To: <20221017105212.77588-4-dwysocha@redhat.com>
On Mon, 2022-10-17 at 06:52 -0400, Dave Wysochanski wrote:
> Convert the NFS buffered read code paths to corresponding netfs APIs,
> but only when fscache is configured and enabled.
>
> The netfs API defines struct netfs_request_ops which must be filled
> in by the network filesystem. For NFS, we only need to define 5 of
> the functions, the main one being the issue_read() function.
> The issue_read() function is called by the netfs layer when a read
> cannot be fulfilled locally, and must be sent to the server (either
> the cache is not active, or it is active but the data is not
> available).
> Once the read from the server is complete, netfs requires a call to
> netfs_subreq_terminated() which conveys either how many bytes were
> read
> successfully, or an error. Note that issue_read() is called with a
> structure, netfs_io_subrequest, which defines the IO requested, and
> contains a start and a length (both in bytes), and assumes the
> underlying
> netfs will return a either an error on the whole region, or the
> number
> of bytes successfully read.
>
> The NFS IO path is page based and the main APIs are the pgio APIs
> defined
> in pagelist.c. For the pgio APIs, there is no way for the caller to
> know how many RPCs will be sent and how the pages will be broken up
> into underlying RPCs, each of which will have their own completion
> and
> return code. In contrast, netfs is subrequest based, a single
> subrequest may contain multiple pages, and a single subrequest is
> initiated with issue_read() and terminated with
> netfs_subreq_terminated().
> Thus, to utilze the netfs APIs, NFS needs some way to accommodate
> the netfs API requirement on the single response to the whole
> subrequest, while also minimizing disruptive changes to the NFS
> pgio layer.
>
> The approach taken with this patch is to allocate a small structure
> for each nfs_netfs_issue_read() call, store the final error and
> number
> of bytes successfully transferred in the structure, and update these
> values
> as each RPC completes. The refcount on the structure is used as a
> marker
> for the last RPC completion, is incremented in
> nfs_netfs_read_initiate(),
> and decremented inside nfs_netfs_read_completion(), when a
> nfs_pgio_header
> contains a valid pointer to the data. On the final put (which
> signals
> the final outstanding RPC is complete) in
> nfs_netfs_read_completion(),
> call netfs_subreq_terminated() with either the final error value (if
> one or more READs complete with an error) or the number of bytes
> successfully transferred (if all RPCs complete successfully). Note
> that when all RPCs complete successfully, the number of bytes
> transferred
> is capped to the length of the subrequest. Capping the transferred
> length
> to the subrequest length prevents "Subreq overread" warnings from
> netfs.
> This is due to the "aligned_len" in nfs_pageio_add_page(), and the
> corner case where NFS requests a full page at the end of the file,
> even when i_size reflects only a partial page (NFS overread).
>
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
This is not doing what I asked for, which was to separate out the
fscache functionality, so that we can call that if and when it is
available.
Instead, it is just wrapping the NFS requests inside netfs requests. As
it stands, that means it is just duplicating information, and adding
unnecessary overhead to the standard I/O path (extra allocations, extra
indirect calls, and extra bloat to the inode).
My expectation is that the standard I/O path should have minimal
overhead, and should certainly not increase the overhead that we
already have. Will this be addressed in future iterations of these
patches?
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2022-10-27 19:16 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 10:52 [PATCH v9 0/5] Convert NFS with fscache to the netfs API Dave Wysochanski
2022-10-17 10:52 ` [PATCH v9 1/5] NFS: Rename readpage_async_filler to nfs_pageio_add_page Dave Wysochanski
2022-10-27 18:07 ` Trond Myklebust
2022-10-28 10:32 ` David Wysochanski
2022-10-28 17:14 ` Trond Myklebust
2022-10-17 10:52 ` [PATCH v9 2/5] NFS: Configure support for netfs when NFS fscache is configured Dave Wysochanski
2022-10-17 10:52 ` [PATCH v9 3/5] NFS: Convert buffered read paths to use netfs when fscache is enabled Dave Wysochanski
2022-10-27 19:16 ` Trond Myklebust [this message]
2022-10-28 11:50 ` David Wysochanski
2022-10-28 16:59 ` Trond Myklebust
2022-10-29 16:46 ` David Wysochanski
2022-10-30 23:25 ` David Wysochanski
2022-10-31 17:42 ` Benjamin Maynard
[not found] ` <1B2E1442-EB0A-43E3-96BB-15C717E966E5@hammerspace.com>
2022-11-12 12:46 ` Benjamin Maynard
2022-11-14 10:41 ` David Wysochanski
2022-11-14 12:42 ` Benjamin Maynard
2022-11-14 13:07 ` Jeff Layton
2022-11-14 13:14 ` Benjamin Maynard
2022-11-14 13:53 ` Jeff Layton
2022-11-14 13:33 ` Daire Byrne
2022-11-14 13:46 ` David Wysochanski
2022-11-14 16:03 ` Benjamin Maynard
2022-11-14 17:11 ` Jeff Layton
2022-11-14 17:34 ` David Wysochanski
2022-11-14 21:25 ` Benjamin Maynard
2022-11-17 11:03 ` Daire Byrne
2023-01-03 20:33 ` Benjamin Maynard
2023-02-06 17:32 ` Benjamin Maynard
2023-02-09 15:09 ` David Wysochanski
2022-10-17 10:52 ` [PATCH v9 4/5] NFS: Remove all NFSIOS_FSCACHE counters due to conversion to netfs API Dave Wysochanski
2022-10-17 10:52 ` [PATCH v9 5/5] NFS: Remove fscache specific trace points and NFS_INO_FSCACHE bit Dave Wysochanski
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=870684b35a45b94c426554a62b63f80f421dbb08.camel@kernel.org \
--to=trondmy@kernel.org \
--cc=anna.schumaker@netapp.com \
--cc=benmaynard@google.com \
--cc=daire.byrne@gmail.com \
--cc=dhowells@redhat.com \
--cc=dwysocha@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/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