Linux NFS development
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: Mike Snitzer <snitzer@kernel.org>
Cc: NeilBrown <neil@brown.name>, Jeff Layton <jlayton@kernel.org>,
	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: NFSD: Add io_cache_{read,write} controls to debugfs
Date: Fri, 5 Sep 2025 14:45:37 -0400	[thread overview]
Message-ID: <4a24c9a1-a56d-46db-90f9-b626c05f027c@kernel.org> (raw)
In-Reply-To: <aLseneIE3Mubr5uV@kernel.org>

On 9/5/25 1:32 PM, Mike Snitzer wrote:
> On Fri, Sep 05, 2025 at 10:55:09AM -0400, Chuck Lever wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Aside from attribution, which I suspect you didn't intend to switch
> these changes from being attributed to me, this looks good (one small
> nit below).

I didn't intend to change the attribution, you're right. My tool
chain's squashing always changes the patch authorship and I don't
always remember to catch it.

I will fix that up.


>> 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.
>>
>> If NFSD_IO_DONTCACHE is specified, all exported filesystems must
>> implement FOP_DONTCACHE, otherwise IO flagged with RWF_DONTCACHE
>> will fail with -EOPNOTSUPP.

Btw, I'd like NFSD to fall back to buffered I/O if the file system's
FOP_DONTCACHE flag is not set. Do you have an objection to that?


>> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>  fs/nfsd/debugfs.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++
>>  fs/nfsd/nfsd.h    |  9 +++++
>>  fs/nfsd/vfs.c     | 19 ++++++++++
>>  3 files changed, 121 insertions(+)
>>
>> Changes from Mike's v9:
>> - Squashed the "io controls" patches together
>> - Removed NFSD_IO_DIRECT for the moment
>> - Addressed a few more checkpatch.pl nits
>>
>> This gives a cleaner platform on which to build the direct I/O code
>> paths, and does not expose partially implemented I/O modes to users.
>>
>> diff --git a/fs/nfsd/debugfs.c b/fs/nfsd/debugfs.c
>> index 84b0c8b559dc..2b1bb716b608 100644
>> --- a/fs/nfsd/debugfs.c
>> +++ b/fs/nfsd/debugfs.c
>> @@ -44,4 +131,10 @@ void nfsd_debugfs_init(void)
>>  
>>  	debugfs_create_file("disable-splice-read", S_IWUSR | S_IRUGO,
>>  			    nfsd_top_dir, NULL, &nfsd_dsr_fops);
>> +
>> +	debugfs_create_file("io_cache_read", 0644, nfsd_top_dir, NULL,
>> +			    &nfsd_io_cache_read_fops);
>> +
>> +	debugfs_create_file("io_cache_write", 0644, nfsd_top_dir, NULL,
>> +			    &nfsd_io_cache_write_fops);
>>  }
> 
> Relative to checkpatch warnings, this ^ code is what I'm aware of.
> For consistency I stuck with "S_IWUSR | S_IRUG", whereas you honored
> checkpatch's suggestion to use 0644.
> 
> Maybe update disable-splice-read to also use 0644 too? But your call!

Still debating that myself. It's a change that is not related to the
purpose of this patch, so I probably should do that kind of clean-up
separately.

-- 
Chuck Lever

  reply	other threads:[~2025-09-05 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 14:55 [PATCH] NFSD: Add io_cache_{read,write} controls to debugfs Chuck Lever
2025-09-05 17:32 ` Mike Snitzer
2025-09-05 18:45   ` Chuck Lever [this message]
2025-09-05 19:15     ` 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=4a24c9a1-a56d-46db-90f9-b626c05f027c@kernel.org \
    --to=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=snitzer@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox