Skip to content

NFSD: keep direct-mode I/O out of the page cache and elide COMMITs

Mike Snitzer linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10NFSD: interlock the use of NFSD_IO_DIRECT for NFS READ and WRITEDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/debugfs.c+83 -66 replies
2/10NFSD: mark the direct middle of a split WRITE IOCB_DONTCACHE as wellDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/vfs.c+19 -00 replies
3/10NFSD: only split a direct-mode WRITE for a worthwhile direct middleDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/debugfs.c fs/nfsd/nfsd.h +1 more+79 -260 replies
4/10NFSD: do not use direct I/O for a READ smaller than its alignmentDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/vfs.c+10 -30 replies
5/10NFSD: Enable return of an updated stable_how to NFS clientsfs/nfsd/nfs3proc.c fs/nfsd/nfs4proc.c fs/nfsd/nfsproc.c +3 more+42 -160 replies
6/10NFSD: let a direct-mode WRITE raise stable_how and elide the client's COMMITDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/debugfs.c fs/nfsd/nfsd.h +1 more+52 -50 replies
7/10NFSD: persist a synchronous direct-mode WRITE once, after all of its segmentsfs/nfsd/vfs.c+19 -10 replies
8/10NFSD: keep boundary page of a split direct-mode WRITE until both writers completeDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/vfs.c+151 -80 replies
9/10NFSD: add direct_misaligned_dontcache debugfs knobDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/debugfs.c fs/nfsd/nfsd.h +1 more+49 -100 replies
10/10NFSD: add tracing for how direct-mode READ and WRITE are servicedDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/trace.h fs/nfsd/vfs.c +1 more+183 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] NFSD: keep direct-mode I/O out of the page cache and elide COMMITs

Hi,

This series builds on NFSD_IO_DIRECT. When a READ or WRITE in a direct mode cannot be direct I/O it now falls back to DONTCACHE rather than to cached buffered I/O, a direct-mode WRITE can report the stability it actually has so the client skips its COMMIT, and new tracepoints show which path each request took.

Patch 1 interlocks io_cache_read and io_cache_write so READ and WRITE are never left on opposite sides of the buffered/direct divide.

Patches 2-4 cover what cannot or should not be direct: the direct middle of a split WRITE is also marked IOCB_DONTCACHE, for when XFS falls back to buffered I/O (-ENOTBLK); a WRITE is split only when that buys a worthwhile direct middle (direct_misaligned_num_pages, default 2); and a READ smaller than its alignment no longer costs a full aligned device read.

Patch 5 is Chuck's "Enable return of an updated stable_how to NFS clients", reworked onto the @iocb_flags argument nfsd_write() now takes in nfsd-next. The Reviewed-by tags from its first posting are dropped because the argument changed.

Patch 6 adds io_cache_write modes 3 and 4, which issue direct I/O like NFSD_IO_DIRECT and raise the reply's stable_how to at least DATA_SYNC or FILE_SYNC. On a pNFS flexfiles share where every write is split across two data servers, the COMMITs alone cost NFSD_IO_DIRECT 31% more server CPU and 42% more client CPU for the same bytes.

Patch 7 persists a synchronous direct-mode WRITE once, after all of its segments, instead of up to three fsyncs per WRITE.

Patch 8 keeps the page that two misaligned WRITEs share in the page cache until both have written it, so the second one no longer has to read it back from disk: with 32 interleaved writers, 704 device reads for 42895 WRITEs where there were 45144 for 45664.

Patch 9 (Jonathan) adds the direct_misaligned_dontcache debugfs knob, default Y; set to N, the parts of a direct-mode WRITE that cannot be direct use cached buffered I/O instead of DONTCACHE.

Patch 10 adds tracepoints for how each direct-mode READ and WRITE was serviced, including why a WRITE was not direct.

Documentation/filesystems/nfs/nfsd-io-modes.rst is updated throughout. The series applies to cel/nfsd-next (ac04dab23b5f) and each patch builds cleanly with W=1.

All review appreciated, 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 (8):
NFSD: interlock the use of NFSD_IO_DIRECT for NFS READ and WRITE
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: let a direct-mode WRITE raise stable_how and elide the client's COMMIT
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

 .../filesystems/nfs/nfsd-io-modes.rst         | 164 ++++++++-
 fs/nfsd/debugfs.c                             |  94 +++++-
 fs/nfsd/nfs3proc.c                            |  16 +-
 fs/nfsd/nfs4proc.c                            |  15 +-
 fs/nfsd/nfsd.h                                |   4 +
 fs/nfsd/nfsproc.c                             |   3 +-
 fs/nfsd/trace.h                               |  90 +++++
 fs/nfsd/vfs.c                                 | 318 +++++++++++++++---
 fs/nfsd/vfs.h                                 |  26 +-
 fs/nfsd/xdr3.h                                |   2 +-
 10 files changed, 665 insertions(+), 67 deletions(-)
Signature · 1 line
2.52.0