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

Jeff Moyer
2020-02-14T21:23:30Z

Ira Weiny <ira.weiny@intel.com> writes:

> [disclaimer: the following assumes the underlying 'device' (superblock)
> supports DAX]
>
> ... which results in S_DAX == false when the file is opened without the mount
> option. The key would be that all directories/files created under a root with
> XFS_DIFLAG2_DAX == true would inherit their flag and be XFS_DIFLAG2_DAX == true
> all the way down the tree. Any file not wanting DAX would need to set
> XFS_DIFLAG2_DAX == false. And setting false could be used on a directory to
> allow a user or group to not use dax on files in that sub-tree.
>
> Then without '-o dax' (XFS_MOUNT_DAX == false) all files when opened set S_DAX
> equal to XFS_DIFLAG2_DAX value. (Directories, as of V4, never get S_DAX set.)
>
> If '-o dax' (XFS_MOUNT_DAX == true) then S_DAX is set on all files.

One more clarifying question. Let's say I set XFS_DIFLAG2_DAX on an
inode. I then open the file, and perform mmap/load/store/etc. I close
the file, and I unset XFS_DIFLAG2_DAX. Will the next open treat the
file as S_DAX or not? My guess is the inode won't be evicted, and so
S_DAX will remain set.

The reason I ask is I've had requests from application developers to do
just this. They want to be able to switch back and forth between dax
modes.

Thanks,
Jeff

> [1] I'm beginning to think that if I type dax one more time I'm going to go
> crazy... :-P

dax dax dax!