From: Mike Snitzer <snitzer@kernel.org>
To: Chuck Lever <cel@kernel.org>, Jeff Layton <jlayton@kernel.org>
Cc: hch@lst.de, linux-nfs@vger.kernel.org
Subject: [PATCH v3 0/9] NFSD: keep direct-mode I/O out of the page cache
Date: Thu, 1 Oct 2026 00:54:53 -0400 [thread overview]
Message-ID: <20261001045502.48381-1-snitzer@kernel.org> (raw)
Hi,
This series changes NFSD's direct write path: io_cache_write modes
where an aligned WRITE goes to the filesystem as O_DIRECT, with
DONTCACHE for the parts a misaligned WRITE cannot issue directly.
1/9 marks the direct middle of a split WRITE IOCB_DONTCACHE, for when
XFS re-issues it buffered (-ENOTBLK). It carries Fixes: and rewrites
the stale nfsd-io-modes.rst sentence in place, so a stable tree
carrying only this patch reads consistently.
2/9 splits a misaligned WRITE only for a direct middle of at least
direct_misaligned_num_pages (default 2). 3/9 (Jonathan) adds
direct_misaligned_dontcache, which selects whether the parts that are
not O_DIRECT are DONTCACHE or cached.
4/9 stops expanding a READ smaller than its alignment into a full
aligned device read.
5/9 persists a synchronous direct-mode WRITE once, after all of its
segments, instead of once per segment. 6/9 keeps the page two
misaligned WRITEs share until both have written it: 704 device reads
for 42895 WRITEs where there were 45144 for 45664. 7/9 adds
tracepoints for how each direct-mode READ and WRITE was serviced.
8/9 and 9/9 are separable and come last for that reason. 8/9 is
Chuck's "Enable return of an updated stable_how to NFS clients",
reworked onto @iocb_flags. 9/9 adds two opt-in io_cache_write modes
that persist every direct-mode WRITE before replying and report
NFS_DATA_SYNC or NFS_FILE_SYNC, so the client sends no COMMIT. A
client can get the same result by sending FILE_SYNC itself, so 1-7
stand without them.
The series applies to cel/nfsd-testing (32eb1a60b456) and each patch
builds with W=1 with no warnings.
Changes since v2:
- Rebased onto cel/nfsd-testing; 8/9 now applies to the xdrgen
nfsd_proc_write().
- 1/9: replaces the "DONTCACHE buffered IO is _not_ used" sentence
instead of adding a paragraph that contradicted it.
- 2/9: the description now opens with the cost a small middle adds,
says the IOCB_* flags only move (the write loop already set
IOCB_DONTCACHE), and says which parts of Christoph's diff are taken
and why the DONTCACHE policy and the memory-misaligned collapse are
not. The DONTCACHE explanation is one comment at no_dio; the
debugfs comment sits on the debugfs_create_u32() call; "three
segments" is now "two or three".
- Reordered: direct_misaligned_dontcache moved up to 3/9, beside
direct_misaligned_num_pages, and the boundary-page patch (now 6/9)
adds its own fields. The two stable_how patches moved to the end
(8/9, 9/9), since nothing before them depends on them.
- 8/9: the async export option clears a local copy, so the reply to a
FILE_SYNC or DATA_SYNC WRITE to an async export is never lowered
(RFC 1813 3.3.7). The description says where NFSv3 and NFSv4 map
the result, and no longer says O_DIRECT persists data.
- 9/9: retitled. The description says an UNSTABLE O_DIRECT write is not
durable, that NFSD_IO_DIRECT is unchanged, and that the new modes cost
a flush per WRITE. They are worth it only where each COMMIT covers
about one WRITE.
- Comments and documentation trimmed throughout.
v2: https://lore.kernel.org/linux-nfs/20260929231329.22018-1-snitzer@kernel.org/
v1: https://lore.kernel.org/linux-nfs/20260929173423.16149-1-snitzer@kernel.org/
Thanks,
Mike
Chuck Lever (1):
NFSD: Enable return of an updated stable_how to NFS clients
Jonathan Flynn (1):
NFSD: add direct_misaligned_dontcache debugfs knob
Mike Snitzer (7):
NFSD: mark the direct middle of a split WRITE IOCB_DONTCACHE as well
NFSD: only split a direct-mode WRITE for a worthwhile direct middle
NFSD: do not use direct I/O for a READ smaller than its alignment
NFSD: persist a synchronous direct-mode WRITE once, after all of its segments
NFSD: keep boundary page of a split direct-mode WRITE until both writers complete
NFSD: add tracing for how direct-mode READ and WRITE are serviced
NFSD: add direct-mode WRITE settings that persist each WRITE
.../filesystems/nfs/nfsd-io-modes.rst | 97 ++++++-
fs/nfsd/debugfs.c | 28 ++
fs/nfsd/nfs3proc.c | 16 +-
fs/nfsd/nfs4proc.c | 15 +-
fs/nfsd/nfsd.h | 4 +
fs/nfsd/nfsproc.c | 3 +-
fs/nfsd/trace.h | 85 +++++++
fs/nfsd/vfs.c | 239 +++++++++++++++---
fs/nfsd/vfs.h | 18 +-
fs/nfsd/xdr3.h | 2 +-
10 files changed, 449 insertions(+), 58 deletions(-)
base-commit: 32eb1a60b456980761cf7a9cee8f907fdc08afb8
--
2.52.0
next reply other threads:[~2026-10-01 4:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 4:54 Mike Snitzer [this message]
2026-10-01 4:54 ` [PATCH v3 1/9] NFSD: mark the direct middle of a split WRITE IOCB_DONTCACHE as well Mike Snitzer
2026-10-01 4:54 ` [PATCH v3 2/9] NFSD: only split a direct-mode WRITE for a worthwhile direct middle Mike Snitzer
2026-10-01 4:54 ` [PATCH v3 3/9] NFSD: add direct_misaligned_dontcache debugfs knob Mike Snitzer
2026-10-01 4:54 ` [PATCH v3 4/9] NFSD: do not use direct I/O for a READ smaller than its alignment Mike Snitzer
2026-10-01 4:54 ` [PATCH v3 5/9] NFSD: persist a synchronous direct-mode WRITE once, after all of its segments Mike Snitzer
2026-10-01 4:54 ` [PATCH v3 6/9] NFSD: keep boundary page of a split direct-mode WRITE until both writers complete Mike Snitzer
2026-10-01 4:55 ` [PATCH v3 7/9] NFSD: add tracing for how direct-mode READ and WRITE are serviced Mike Snitzer
2026-10-01 4:55 ` [PATCH v3 8/9] NFSD: Enable return of an updated stable_how to NFS clients Mike Snitzer
2026-10-01 4:55 ` [PATCH v3 9/9] NFSD: add direct-mode WRITE settings that persist each WRITE Mike Snitzer
2026-10-01 22:58 ` [PATCH v3 0/9] NFSD: keep direct-mode I/O out of the page cache Mike Snitzer
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=20261001045502.48381-1-snitzer@kernel.org \
--to=snitzer@kernel.org \
--cc=cel@kernel.org \
--cc=hch@lst.de \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.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