From: Mike Snitzer <snitzer@kernel.org>
To: Chuck Lever <cel@kernel.org>
Cc: Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
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: Re: [PATCH v2] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE
Date: Mon, 13 Oct 2025 11:41:32 -0400 [thread overview]
Message-ID: <aO0drJGxjyRLwNCK@kernel.org> (raw)
In-Reply-To: <338ffe90-19ee-4185-9668-41e3a79d8851@kernel.org>
Hi Chuck,
On Thu, Oct 09, 2025 at 01:46:34PM -0400, Chuck Lever wrote:
> On 10/8/25 2:59 PM, Mike Snitzer wrote:
> > +
> > +static noinline_for_stack int
> > +nfsd_direct_write(struct svc_rqst *rqstp, struct svc_fh *fhp,
> > + struct nfsd_file *nf, loff_t offset, unsigned int nvecs,
> > + unsigned long *cnt, struct kiocb *kiocb)
> > +{
> > + struct nfsd_write_dio write_dio;
> > +
> > + /* Any buffered IO issued here will be misaligned, use
> > + * IOCB_SYNC to ensure it has completed before returning.
> > + */
> > + kiocb->ki_flags |= IOCB_SYNC;
> > + /* Check if IOCB_DONTCACHE should be used when issuing buffered IO;
> > + * if so, it will be ignored for any DIO issued here.
> > + */
> > + if (nf->nf_file->f_op->fop_flags & FOP_DONTCACHE)
> > + kiocb->ki_flags |= IOCB_DONTCACHE;
> > +
> > + if (nfsd_is_write_dio_possible(offset, *cnt, nf, &write_dio)) {
> > + trace_nfsd_write_direct(rqstp, fhp, offset, *cnt);
> > + return nfsd_issue_write_dio(rqstp, fhp, nf, offset, nvecs,
> > + cnt, kiocb, &write_dio);
> > + }
> > +
> > + return nfsd_buffered_write(rqstp, nf->nf_file, nvecs, cnt, kiocb);
> > +}
>
> Handful of initial comments:
>
> The current NFSv3 code path, and perhaps NFSv4 too, doesn't support
> changing a WRITE marked as UNSTABLE to FILE_SYNC. I'm not seeing that
> rectified in this patch. I have a patch that enables changing the
> "stable_how" setting, but it's on a system at home. I'll post it in
> a couple of days and we can build on that.
Just a quick follow-up to see if you might have time to either share
your patch and/or rebase NFSD Direct WRITE ontop of it?
> In nfsd_direct_write we're setting IOCB_SYNC early. When falling back to
> BUFFERED_IO, that setting is preserved, and the fallback buffered path
> is now always FILE_SYNC. We should discuss whether the fallback in this
> case should be always FILE_SYNC or should allow UNSTABLE.
Probably makes sense to only set IOCB_SYNC _and_ IOCB_DONTCACHE if
nfsd_is_write_dio_possible() returns true. So inverting
nfsd_direct_write()'s flow as such:
if (!nfsd_is_write_dio_possible())
return nfsd_buffered_write()
// could push the setting these flags into nfsd_issue_write_dio?
kiocb->ki_flags |= IOCB_SYNC;
if (nf->nf_file->f_op->fop_flags & FOP_DONTCACHE)
kiocb->ki_flags |= IOCB_DONTCACHE;
trace_nfsd_write_direct(rqstp, fhp, offset, *cnt);
return nfsd_issue_write_dio()
But the devil is in the details in conjunction with needing to rebase
to deal with your change to pass stable_how by reference, etc.
> Nit: I'd rather use the normal kernel comment style here, where an
> initial "/*" appears on a line by itself.
OK, will use that in general moving forward.
Thanks,
Mike
next prev parent reply other threads:[~2025-10-13 15:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 19:05 [PATCH v1 0/3] NFSD direct I/O read Chuck Lever
2025-09-09 19:05 ` [PATCH v1 1/3] NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support Chuck Lever
2025-09-09 23:07 ` NeilBrown
2025-09-09 19:05 ` [PATCH v1 2/3] NFSD: pass nfsd_file to nfsd_iter_read() Chuck Lever
2025-09-09 23:20 ` NeilBrown
2025-09-09 19:05 ` [PATCH v1 3/3] NFSD: Implement NFSD_IO_DIRECT for NFS READ Chuck Lever
2025-09-09 23:16 ` Mike Snitzer
2025-09-09 23:37 ` NeilBrown
2025-09-09 23:39 ` Chuck Lever
2025-09-09 23:48 ` Chuck Lever
2025-09-10 1:54 ` NeilBrown
2025-09-10 1:52 ` NeilBrown
2025-09-10 14:23 ` Chuck Lever
2025-09-09 23:56 ` Mike Snitzer
2025-09-10 11:37 ` Jeff Layton
2025-09-09 23:33 ` [PATCH 0/2] NFSD: continuation of NFSD DIRECT Mike Snitzer
2025-09-09 23:33 ` [PATCH 1/2] sunrpc: add an extra reserve page to svc_serv_maxpages() Mike Snitzer
2025-09-10 14:29 ` Chuck Lever
2025-09-09 23:33 ` [PATCH 2/2] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Mike Snitzer
2025-10-08 18:59 ` [PATCH v2] " Mike Snitzer
2025-10-09 15:04 ` Jeff Layton
2025-10-09 17:46 ` Chuck Lever
2025-10-13 15:41 ` Mike Snitzer [this message]
2025-10-11 11:57 ` kernel test robot
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=aO0drJGxjyRLwNCK@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=neil@brown.name \
--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 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.