Re: [PATCH 5/6] NFSD: leverage DIO alignment to selectively issue O_DIRECT reads and writes

Christoph Hellwig
2025-06-12T07:23:46Z

On Wed, Jun 11, 2025 at 08:23:34AM -0400, Mike Snitzer wrote:
> On Wed, Jun 11, 2025 at 12:00:02AM -0700, Christoph Hellwig wrote:
> > On Tue, Jun 10, 2025 at 04:57:36PM -0400, Mike Snitzer wrote:
> > > IO must be aligned, otherwise it falls back to using buffered IO.
> > >
> > > RWF_DONTCACHE is _not_ currently used for misaligned IO (even when
> > > nfsd/enable-dontcache=1) because it works against us (due to RMW
> > > needing to read without benefit of cache), whereas buffered IO enables
> > > misaligned IO to be more performant.
> >
> > This seems to "randomly" mix direct I/O and buffered I/O on a file.
>
> It isn't random, if the IO is DIO-aligned it uses direct I/O.

Which as an I/O pattern does look pretty random :)

> > But maybe also explain what this is trying to address to start with?
>
> Ha, I suspect you saw my too-many-words 0th patch header [1] and
> ignored it? Solid feedback, I need to be more succinct and I'm
> probably too close to this work to see the gaps in introduction and
> justification but will refine, starting now:

Well, I was mostly asking about the description for this patch in
particular. Given that all the naming and the previous patches seemed
to be about dontcache I/O having optional direct I/O in here looked
really confusing.