Linux NFS development
 help / color / mirror / Atom feed
* [PATCH v3 0/9] NFSD: keep direct-mode I/O out of the page cache
@ 2026-10-01  4:54 Mike Snitzer
  2026-10-01  4:54 ` [PATCH v3 1/9] NFSD: mark the direct middle of a split WRITE IOCB_DONTCACHE as well Mike Snitzer
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Mike Snitzer @ 2026-10-01  4:54 UTC (permalink / raw)
  To: Chuck Lever, Jeff Layton; +Cc: hch, linux-nfs

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-10-01 22:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01  4:54 [PATCH v3 0/9] NFSD: keep direct-mode I/O out of the page cache Mike Snitzer
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox