Re: [PATCH v3 00/12] Enable per-file/directory DAX operations V3

Darrick J. Wong
2020-02-13T20:01:03Z

On Thu, Feb 13, 2020 at 11:05:13AM -0800, Ira Weiny wrote:
> On Thu, Feb 13, 2020 at 11:01:57AM -0800, 'Ira Weiny' wrote:
> > On Wed, Feb 12, 2020 at 02:49:48PM -0500, Jeff Moyer wrote:
> > > Ira Weiny <ira.weiny@intel.com> writes:
> > >
>
> [snip]
>
> > > Given that we document the dax mount
> > > option as "the way to get dax," it may be a good idea to allow for a
> > > user to selectively disable dax, even when -o dax is specified. Is that
> > > possible?
> >
> > Not with this patch set. And I'm not sure how that would work. The idea was
> > that -o dax was simply an override for users who were used to having their
> > entire FS be dax. We wanted to depreciate the use of "-o dax" in general. The
> > individual settings are saved so I don't think it makes sense to ignore the -o
> > dax in favor of those settings. Basically that would IMO make the -o dax
> > useless.
>
> Oh and I forgot to mention that setting 'dax' on the root of the FS basically
> provides '-o dax' functionality by default with the ability to "turn it off"
> for files.

Please don't further confuse FS_XFLAG_DAX and S_DAX. They are two
separate flags with two separate behaviors:

FS_XFLAG_DAX is a filesystem inode metadata flag.

Setting FS_XFLAG_DAX on a directory causes all files and directories
created within that directory to inherit FS_XFLAG_DAX.

Mounting with -o dax causes all files and directories created to have
FS_XFLAG_DAX set regardless of the parent's status.

The FS_XFLAG_DAX can be get and set via the fs[g]etxattr ioctl.

-------

S_DAX is the flag that controls the IO path in the kernel for a given
inode.

Loading a file inode into the kernel (via _iget) with FS_XFLAG_DAX set
or creating a file inode that inherits FS_XFLAG_DAX causes the incore
inode to have the S_DAX flag set if the storage device supports it.

Files with S_DAX set use the dax IO paths through the kernel.

The S_DAX flag can be queried via statx.

--D

> Ira
>
> >
> > Ira
> >