]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFSD: Add io_cache_{read,write} controls to debugfs
authorMike Snitzer <snitzer@kernel.org>
Sat, 6 Sep 2025 21:25:11 +0000 (17:25 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 1 Oct 2025 19:54:01 +0000 (15:54 -0400)
commit6304affe45648294229d18cab2b4ba6d40045570
tree35b39d4217e8cdffbd2485f4f02694a682f2a583
parentd6e80d48f9c83fc766c1418c584dbba5a0bc9e8a
NFSD: Add io_cache_{read,write} controls to debugfs

Add 'io_cache_read' to NFSD's debugfs interface so that any data
read by NFSD will either be:
- cached using page cache (NFSD_IO_BUFFERED=0)
- cached but removed from the page cache upon completion
  (NFSD_IO_DONTCACHE=1).

io_cache_read may be set by writing to:
  /sys/kernel/debug/nfsd/io_cache_read

Add 'io_cache_write' to NFSD's debugfs interface so that any data
written by NFSD will either be:
- cached using page cache (NFSD_IO_BUFFERED=0)
- cached but removed from the page cache upon completion
  (NFSD_IO_DONTCACHE=1).

io_cache_write may be set by writing to:
  /sys/kernel/debug/nfsd/io_cache_write

The default value for both settings is NFSD_IO_BUFFERED, which is
NFSD's existing behavior for both read and write. Changes to these
settings take immediate effect for all exports and NFS versions.

Currently only xfs and ext4 implement RWF_DONTCACHE. For file
systems that do not implement RWF_DONTCACHE, NFSD use only buffered
I/O when the io_cache setting is NFSD_IO_DONTCACHE.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/debugfs.c
fs/nfsd/nfsd.h
fs/nfsd/vfs.c