On Thu, Jul 10, 2025 at 12:47:43AM -0700, Christoph Hellwig wrote: > On Tue, Jul 08, 2025 at 12:06:17PM -0400, Mike Snitzer wrote: > > 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). > > - not cached (NFSD_IO_DIRECT=2) > > > > io_cache_read is 0 by default. It may be set by writing to: > > /sys/kernel/debug/nfsd/io_cache_read > > > > If NFSD_IO_DONTCACHE is specified using 1, FOP_DONTCACHE must be > > advertised as supported by the underlying filesystem (e.g. XFS), > > otherwise all IO flagged with RWF_DONTCACHE will fail with > > -EOPNOTSUPP. > > > > If NFSD_IO_DIRECT is specified using 2, the IO must be aligned > > relative to the underlying block device's logical_block_size. Also the > > memory buffer used to store the read must be aligned relative to the > > underlying block device's dma_alignment. > > Does this also need some kind of check that direct I/O is supported > at all by the file system / fops instance? Long-term: definitely. Near-term: not going to add it because it'd have to be checked on a per-IO basis (because this debugfs-based interface is a global setting so we don't have a specific export to check at the time the request to use O_DIRECT is made via debugfs). Once we graduate to having a per-export control interface in NFSD we can then verify export's underlying filesystem supports O_DIRECT. Hope this makes sense, thanks. Mike