xfs
[Top] [All Lists]

[PATCH 3/3] xfs_io: add support for changing the new inode DAX attribute

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/3] xfs_io: add support for changing the new inode DAX attribute
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 15 Feb 2016 16:32:26 +1100
Cc: ross.zwisler@xxxxxxxxxxxxxxx, jack@xxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1455514346-15481-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1455514346-15481-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

It is changed via the FS_IOC_FSSETXATTR ioctl, so add the new flag
to the platform definitions for  userspace that don't this API. Then
add support to the relevant xfs_io chattr and stat commands.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 include/darwin.h  | 1 +
 include/freebsd.h | 1 +
 include/irix.h    | 1 +
 include/linux.h   | 1 +
 io/attr.c         | 5 ++++-
 5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/darwin.h b/include/darwin.h
index 2baa536..a52030d 100644
--- a/include/darwin.h
+++ b/include/darwin.h
@@ -312,6 +312,7 @@ struct fsxattr {
 #define FS_XFLAG_EXTSZINHERIT  0x00001000      /* inherit inode extent size */
 #define FS_XFLAG_NODEFRAG      0x00002000      /* do not defragment */
 #define FS_XFLAG_FILESTREAM    0x00004000      /* use filestream allocator */
+#define FS_XFLAG_DAX           0x00008000      /* use DAX for IO */
 #define FS_XFLAG_HASATTR       0x80000000      /* no DIFLAG for this   */
 
 #define FS_IOC_FSGETXATTR     _IOR ('X', 31, struct fsxattr)
diff --git a/include/freebsd.h b/include/freebsd.h
index fe567d4..f7e0c75 100644
--- a/include/freebsd.h
+++ b/include/freebsd.h
@@ -202,6 +202,7 @@ struct fsxattr {
 #define FS_XFLAG_EXTSZINHERIT  0x00001000      /* inherit inode extent size */
 #define FS_XFLAG_NODEFRAG      0x00002000      /* do not defragment */
 #define FS_XFLAG_FILESTREAM    0x00004000      /* use filestream allocator */
+#define FS_XFLAG_DAX           0x00008000      /* use DAX for IO */
 #define FS_XFLAG_HASATTR       0x80000000      /* no DIFLAG for this   */
 
 #define FS_IOC_FSGETXATTR     _IOR ('X', 31, struct fsxattr)
diff --git a/include/irix.h b/include/irix.h
index bdb4b6a..c2191ee 100644
--- a/include/irix.h
+++ b/include/irix.h
@@ -447,6 +447,7 @@ struct fsxattr {
 #define FS_XFLAG_EXTSZINHERIT  0x00001000      /* inherit inode extent size */
 #define FS_XFLAG_NODEFRAG      0x00002000      /* do not defragment */
 #define FS_XFLAG_FILESTREAM    0x00004000      /* use filestream allocator */
+#define FS_XFLAG_DAX           0x00008000      /* use DAX for IO */
 #define FS_XFLAG_HASATTR       0x80000000      /* no DIFLAG for this   */
 
 #define FS_IOC_FSGETXATTR              F_FSGETXATTR
diff --git a/include/linux.h b/include/linux.h
index 17391c3..cc0f70c 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -205,6 +205,7 @@ struct fsxattr {
 #define FS_XFLAG_EXTSZINHERIT  0x00001000      /* inherit inode extent size */
 #define FS_XFLAG_NODEFRAG      0x00002000      /* do not defragment */
 #define FS_XFLAG_FILESTREAM    0x00004000      /* use filestream allocator */
+#define FS_XFLAG_DAX           0x00008000      /* use DAX for IO */
 #define FS_XFLAG_HASATTR       0x80000000      /* no DIFLAG for this   */
 
 #define FS_IOC_FSGETXATTR     _IOR ('X', 31, struct fsxattr)
diff --git a/io/attr.c b/io/attr.c
index 6fa08bf..0186b1d 100644
--- a/io/attr.c
+++ b/io/attr.c
@@ -47,9 +47,10 @@ static struct xflags {
        { FS_XFLAG_EXTSZINHERIT,        "E", "extsz-inherit"    },
        { FS_XFLAG_NODEFRAG,            "f", "no-defrag"        },
        { FS_XFLAG_FILESTREAM,          "S", "filestream"       },
+       { FS_XFLAG_DAX,                 "x", "dax"              },
        { 0, NULL, NULL }
 };
-#define CHATTR_XFLAG_LIST      "r"/*p*/"iasAdtPneEfS"
+#define CHATTR_XFLAG_LIST      "r"/*p*/"iasAdtPneEfSx"
 
 static void
 lsattr_help(void)
@@ -73,6 +74,7 @@ lsattr_help(void)
 " E -- children created in this directory inherit the extent size value\n"
 " f -- do not include this file when defragmenting the filesystem\n"
 " S -- enable filestreams allocator for this directory\n"
+" x -- Use direct access (DAX) for data in this file\n"
 "\n"
 " Options:\n"
 " -R -- recursively descend (useful when current file is a directory)\n"
@@ -108,6 +110,7 @@ chattr_help(void)
 " +/-E -- set/clear the extent-size inheritance flag\n"
 " +/-f -- set/clear the no-defrag flag\n"
 " +/-S -- set/clear the filestreams allocator flag\n"
+" +/-x -- set/clear the direct access (DAX) flag\n"
 " Note1: user must have certain capabilities to modify 
immutable/append-only.\n"
 " Note2: immutable/append-only files cannot be deleted; removing these files\n"
 "        requires the immutable/append-only flag to be cleared first.\n"
-- 
2.5.0

<Prev in Thread] Current Thread [Next in Thread>