Re: [PATCH 0/6] NFSD: add enable-dontcache and initially use it to add DIO support

Christoph Hellwig
2025-06-12T07:39:45Z

On Wed, Jun 11, 2025 at 08:55:20AM -0400, Jeff Layton wrote:
> To be clear, my concern with *_DONTCACHE is this bit in
> generic_write_sync():

> I understand why it was done, but it means that we're kicking off
> writeback for small ranges after every write. I think we'd be better
> served by allowing for a little batching, and just kick off writeback
> (maybe even for the whole inode) after a short delay. IOW, I agree with
> Dave Chinner that we need some sort of writebehind window.

Agreed. Not offloading to the worker threads also hurts the I/O
pattern. I guess Jens did that to not overwhelm the single threaded
worker thread, but that might be solved with the pending series for
multiple writeback workers.

Another thing is that using the page cache for reads is probably
rather pointless. I've been wondering if we should just change
the direct I/O read code to read from the page cache if there are
cached pages and otherwise go direct to the device. That would make
a setup using buffered writes (without or without the dontcache
flag) and direct I/O reads safe.