Re: [PATCH V7 9/9] Documentation/dax: Update Usage section

From: Darrick J. Wong
Date: Tue Apr 14 2020 - 15:58:49 EST


On Tue, Apr 14, 2020 at 12:04:57PM -0700, Dan Williams wrote:
> On Tue, Apr 14, 2020 at 9:15 AM Darrick J. Wong <darrick.wong@xxxxxxxxxx> wrote:
> >
> > On Mon, Apr 13, 2020 at 10:21:26PM -0700, Dan Williams wrote:
> > > On Sun, Apr 12, 2020 at 10:41 PM <ira.weiny@xxxxxxxxx> wrote:
> > > >
> > > > From: Ira Weiny <ira.weiny@xxxxxxxxx>
> > > >
> > > > Update the Usage section to reflect the new individual dax selection
> > > > functionality.
> > > >
> > > > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > > >
> > > > ---
> > > > Changes from V6:
> > > > Update to allow setting FS_XFLAG_DAX any time.
> > > > Update with list of behaviors from Darrick
> > > > 20200409165927.GD6741@magnolia/">https://lore.kernel.org/lkml/20200409165927.GD6741@magnolia/
> > > >
> > > > Changes from V5:
> > > > Update to reflect the agreed upon semantics
> > > > https://lore.kernel.org/lkml/20200405061945.GA94792@xxxxxxxxxxxxxxxxxxxxxxxxx/
> > > > ---
> > > > Documentation/filesystems/dax.txt | 166 +++++++++++++++++++++++++++++-
> > > > 1 file changed, 163 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/Documentation/filesystems/dax.txt b/Documentation/filesystems/dax.txt
> > > > index 679729442fd2..af14c1b330a9 100644
> > > > --- a/Documentation/filesystems/dax.txt
> > > > +++ b/Documentation/filesystems/dax.txt
> > > > @@ -17,11 +17,171 @@ For file mappings, the storage device is mapped directly into userspace.
> > > > Usage
> > > > -----
> > > >
> > > > -If you have a block device which supports DAX, you can make a filesystem
> > > > +If you have a block device which supports DAX, you can make a file system
> > > > on it as usual. The DAX code currently only supports files with a block
> > > > size equal to your kernel's PAGE_SIZE, so you may need to specify a block
> > > > -size when creating the filesystem. When mounting it, use the "-o dax"
> > > > -option on the command line or add 'dax' to the options in /etc/fstab.
> > > > +size when creating the file system.
> > > > +
> > > > +Currently 2 filesystems support DAX, ext4 and xfs. Enabling DAX on them is
> > > > +different at this time.
> > > > +
> > > > +Enabling DAX on ext4
> > > > +--------------------
> > > > +
> > > > +When mounting the filesystem, use the "-o dax" option on the command line or
> > > > +add 'dax' to the options in /etc/fstab.
> > > > +
> > > > +
> > > > +Enabling DAX on xfs
> > > > +-------------------
> > > > +
> > > > +Summary
> > > > +-------
> > > > +
> > > > + 1. There exists an in-kernel access mode flag S_DAX that is set when
> > > > + file accesses go directly to persistent memory, bypassing the page
> > > > + cache.
> > >
> > > I had reserved some quibbling with this wording, but now that this is
> > > being proposed as documentation I'll let my quibbling fly. "dax" may
> > > imply, but does not require persistent memory nor does it necessarily
> > > "bypass page cache". For example on configurations that support dax,
> > > but turn off MAP_SYNC (like virtio-pmem), a software flush is
> > > required. Instead, if we're going to define "dax" here I'd prefer it
> > > be a #include of the man page definition that is careful (IIRC) to
> > > only talk about semantics and not backend implementation details. In
> > > other words, dax is to page-cache as direct-io is to page cache,
> > > effectively not there, but dig a bit deeper and you may find it.
> >
> > Uh, which manpage? Are you talking about the MAP_SYNC documentation?
>
> No, I was referring to the proposed wording for STATX_ATTR_DAX.
> There's no reason for this description to say anything divergent from
> that description.

Ahh, ok. Something like this, then:

1. There exists an in-kernel access mode flag S_DAX. When set, the
file is in the DAX (cpu direct access) state. DAX state attempts to
minimize software cache effects for both I/O and memory mappings of
this file. The S_DAX state is exposed to userspace via the
STATX_ATTR_DAX statx flag.

See the STATX_ATTR_DAX in the statx(2) manpage for more information.

--D