From: Mike Snitzer <snitzer@kernel.org>
To: NeilBrown <neilb@ownmail.net>, Chuck Lever <cel@kernel.org>
Cc: Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: [RFC PATCH v3 4/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ (v3 and older) [Was: "Re: [PATCH v3 3/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ"]
Date: Wed, 24 Sep 2025 14:56:20 -0400 [thread overview]
Message-ID: <aNQ-1OSG9Ti5XbUm@kernel.org> (raw)
In-Reply-To: <aNQL3fFzFZIL3I4u@kernel.org>
On Wed, Sep 24, 2025 at 11:18:53AM -0400, Mike Snitzer wrote:
>
> FYI, I've been testing with NFSv3. So nfsd_read -> nfsd_iter_read
>
> The last time I tested NFSv4 was with my DIO READ code that checked
> the memory alignment with precision (albeit adding more work per IO,
> which Chuck would like to avoid).
We could just enable NFSD_IO_DIRECT for NFS v3 and older. And work
out adding support for NFSv4 as follow-on work for next cycle?
This could be folded into Patch 3/3, and its header updated to be
clear that NFS v4+ isn't supported yet:
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 96792f8a8fc5a..459a29f377c2c 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1182,10 +1182,6 @@ __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
case NFSD_IO_BUFFERED:
break;
case NFSD_IO_DIRECT:
- if (nf->nf_dio_read_offset_align &&
- !rqstp->rq_res.page_len && !base)
- return nfsd_direct_read(rqstp, fhp, nf, offset,
- count, eof);
fallthrough;
case NFSD_IO_DONTCACHE:
if (file->f_op->fop_flags & FOP_DONTCACHE)
@@ -1622,8 +1618,14 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
file = nf->nf_file;
if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp))
err = nfsd_splice_read(rqstp, fhp, file, offset, count, eof);
- else
+ else {
+ /* Use vectored reads, for NFS v3 and older */
+ if (nfsd_io_cache_read == NFSD_IO_DIRECT &&
+ nf->nf_dio_read_offset_align &&
+ !rqstp->rq_res.page_len && !base)
+ return nfsd_direct_read(rqstp, fhp, nf, offset, count, eof);
err = nfsd_iter_read(rqstp, fhp, nf, offset, count, 0, eof);
+ }
nfsd_file_put(nf);
trace_nfsd_read_done(rqstp, fhp, offset, *count);
next prev parent reply other threads:[~2025-09-24 18:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 14:11 [PATCH v3 0/3] NFSD direct I/O read Chuck Lever
2025-09-22 14:11 ` [PATCH v3 1/3] NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support Chuck Lever
2025-09-24 14:00 ` Chuck Lever
2025-09-22 14:11 ` [PATCH v3 2/3] NFSD: pass nfsd_file to nfsd_iter_read() Chuck Lever
2025-09-22 14:11 ` [PATCH v3 3/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ Chuck Lever
2025-09-23 22:26 ` Mike Snitzer
2025-09-23 22:49 ` Chuck Lever
2025-09-23 23:31 ` Mike Snitzer
2025-09-23 23:48 ` NeilBrown
2025-09-23 23:52 ` Chuck Lever
2025-09-24 7:30 ` NeilBrown
2025-09-24 14:12 ` Mike Snitzer
2025-09-24 15:18 ` Mike Snitzer
2025-09-24 18:56 ` Mike Snitzer [this message]
2025-09-25 2:56 ` [RFC PATCH v3 4/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ (v3 and older) [Was: "Re: [PATCH v3 3/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ"] Jonathan Flynn
2025-09-25 13:13 ` Jonathan Flynn
2025-09-26 0:18 ` [PATCH v3 3/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ NeilBrown
2025-09-26 1:30 ` Mike Snitzer
2025-09-24 18:56 ` Chuck Lever
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=aNQ-1OSG9Ti5XbUm@kernel.org \
--to=snitzer@kernel.org \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@ownmail.net \
--cc=okorniev@redhat.com \
--cc=tom@talpey.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;
as well as URLs for NNTP newsgroup(s).