2020-02-13 19:05:37

by Ira Weiny

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

On Wed, Feb 12, 2020 at 02:49:48PM -0500, Jeff Moyer wrote:
> Ira Weiny <[email protected]> writes:
>
> > On Mon, Feb 10, 2020 at 10:15:47AM -0500, Jeff Moyer wrote:
> >> Hi, Ira,
> >>
> >> Could you please include documentation patches as part of this series?
> >
> > I do have an update to the vfs.rst doc in
> >
> > fs: Add locking for a dynamic DAX state
> >
> > I'm happy to do more but was there something specific you would like to see?
> > Or documentation in xfs perhaps?
>
> Sorry, I was referring to your statx man page addition.

Ah yea I guess I could include that as a patch. I just wanted to get buy off
on the whole thing prior to setting documentation in.

> It would be
> nice if we could find a home for the information in your cover letter,
> too. Right now, I'm not sure how application developers are supposed to
> figure out how to use the per-inode settings.

I'm not sure either. But this is probably a good start:

https://www.kernel.org/doc/Documentation/filesystems/dax.txt

Something under the Usage section like:

diff --git a/Documentation/filesystems/dax.txt b/Documentation/filesystems/dax.txt
index 679729442fd2..1bab5d5d775b 100644
--- a/Documentation/filesystems/dax.txt
+++ b/Documentation/filesystems/dax.txt
@@ -20,8 +20,18 @@ Usage
If you have a block device which supports DAX, you can make a filesystem
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 filesystem.
+
+Files can then be enabled to use dax using the statx system call or an
+application using it like 'xfs_io'. Directories can also be enabled for dax
+to have the file system automatically enable dax on all files within those
+directories.
+
+Alternately, when mounting it one can use the "-o dax" option on the command
+line or add 'dax' to the options in /etc/fstab to globaly override all files to
+use dax on that filesystem. Using the "-o dax" does not change the state of
+individual files so remounting without "-o dax" will revert them to the state
+saved in the filesystem meta data.


Implementation Tips for Block Driver Writers

>
> If I read your cover letter correctly, the mount option overrides any
> on-disk setting. Is that right?

Yes

> 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.

Ira


2020-02-13 19:10:33

by Ira Weiny

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

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 <[email protected]> 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.

Ira

>
> Ira
>

2020-02-13 20:01:59

by Darrick J. Wong

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

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 <[email protected]> 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
> >