Skip to content

RFC Enable ext4 support for per-file/directory DAX operations

[email protected] linux-ext4 linux-fsdevel linux-xfs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 33 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8fs/ext4: Narrow scope of DAX check in setflagsfs/ext4/ioctl.c+2 -21 reply
2/8fs/ext4: Disallow verity if inode is DAXfs/ext4/verity.c+3 -08 replies
3/8fs/ext4: Disallow encryption if inode is DAXfs/ext4/super.c+1 -97 replies
4/8fs/ext4: Introduce DAX inode flagfs/ext4/ext4.h fs/ext4/ioctl.c+29 -512 replies
5/8fs/ext4: Make DAX mount option a tri-statefs/ext4/ext4.h fs/ext4/super.c+40 -41 reply
6/8fs/ext4: Update ext4_should_use_dax()fs/ext4/inode.c+12 -42 replies
7/8fs/ext4: Only change S_DAX on inode loadfs/ext4/ext4.h fs/ext4/ialloc.c fs/ext4/inode.c +3 more+12 -92 replies
8/8Documentation/dax: Update DAX enablement for ext4Documentation/filesystems/dax.txt+1 -120 replies

Reviews trailers per patch

2 of 8 patches have a Reviewed-by or Acked-by.

PatchJan Kara
1/8R-b
2/8R-b
3/8
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH RFC 0/8] Enable ext4 support for per-file/directory DAX operations

From: Ira Weiny <[email protected]>

Enable the same per file DAX support to ext4 as was done for xfs. This series builds and depends on the V7 series for xfs.[1]

To summarize:

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. Applications must call statx to discover the current S_DAX state (STATX_ATTR_DAX).

2. There exists an advisory file inode flag FS_XFLAG_DAX that is inherited from the parent directory FS_XFLAG_DAX inode flag at file creation time. This advisory flag can be set or cleared at any time, but doing so does not immediately affect the S_DAX state.

Unless overridden by mount options (see (3)), if FS_XFLAG_DAX is set and the fs is on pmem then it will enable S_DAX at inode load time; if FS_XFLAG_DAX is not set, it will not enable S_DAX.

3. There exists a dax= mount option.

"-o dax=never" means "never set S_DAX, ignore FS_XFLAG_DAX."

"-o dax=always" means "always set S_DAX (at least on pmem),
and ignore FS_XFLAG_DAX."

"-o dax" is an alias for "dax=always".

"-o dax=inode" means "follow FS_XFLAG_DAX" and is the default.

4. There exists an advisory directory inode flag FS_XFLAG_DAX that can be set or cleared at any time. The flag state is inherited by any files or subdirectories when they are created within that directory.

5. Programs that require a specific file access mode (DAX or not DAX) can do one of the following:

(a) Create files in directories that the FS_XFLAG_DAX flag set as needed; or

(b) Have the administrator set an override via mount option; or

(c) Set or clear the file's FS_XFLAG_DAX flag as needed. Programs must then cause the kernel to evict the inode from memory. This can be done by:

i> Closing the file and re-opening the file and using statx to
see if the fs has changed the S_DAX flag; and

ii> If the file still does not have the desired S_DAX access
mode, either unmount and remount the filesystem, or close the file and use drop_caches.

6. It is expected that users who want to squeeze every last bit of performance out of the particular rough and tumble bits of their storage will also be exposed to the difficulties of what happens when the operating system can't totally virtualize those hardware capabilities. DAX is such a feature.

[1] https://lore.kernel.org/lkml/[email protected]/

To: [email protected]
Cc: "Darrick J. Wong" <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: "Theodore Y. Ts'o" <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Ira Weiny (8):
fs/ext4: Narrow scope of DAX check in setflags fs/ext4: Disallow verity if inode is DAX fs/ext4: Disallow encryption if inode is DAX fs/ext4: Introduce DAX inode flag fs/ext4: Make DAX mount option a tri-state fs/ext4: Update ext4_should_use_dax() fs/ext4: Only change S_DAX on inode load Documentation/dax: Update DAX enablement for ext4

 Documentation/filesystems/dax.txt | 13 +------
 fs/ext4/ext4.h                    | 16 ++++++---
 fs/ext4/ialloc.c                  |  2 +-
 fs/ext4/inode.c                   | 22 ++++++++----
 fs/ext4/ioctl.c                   | 28 ++++++++++++---
 fs/ext4/super.c                   | 57 +++++++++++++++++++++++--------
 fs/ext4/verity.c                  |  5 ++-
 7 files changed, 99 insertions(+), 44 deletions(-)
Signature · 1 line
2.25.1