]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
chattr/lsattr: Support dax attribute
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Tue, 28 Jul 2020 05:33:21 +0000 (13:33 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 1 Oct 2020 20:55:16 +0000 (16:55 -0400)
Use the letter 'x' to set/get dax attribute on a directory/file.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/e2p/pf.c
lib/ext2fs/ext2_fs.h
misc/chattr.1.in
misc/chattr.c

index 0c6998c4b7660517372eecb3de4d6294261cc4ca..61fd4ab700ac6938e48666be49bd18894f95a368 100644 (file)
@@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
        { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
        { EXT4_EXTENTS_FL, "e", "Extents" },
        { FS_NOCOW_FL, "C", "No_COW" },
+       { FS_DAX_FL, "x", "DAX" },
        { EXT4_CASEFOLD_FL, "F", "Casefold" },
        { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
        { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
index d31891c448a30d32c8dad9712eb2fbb58f0ca513..475ecf939794357d8d01d3397bfdb37c682f0f46 100644 (file)
@@ -335,6 +335,7 @@ struct ext2_dx_tail {
 /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
 #define FS_NOCOW_FL                    0x00800000 /* Do not cow file */
 #define EXT4_SNAPFILE_FL               0x01000000  /* Inode is a snapshot */
+#define FS_DAX_FL                      0x02000000 /* Inode is DAX */
 #define EXT4_SNAPFILE_DELETED_FL       0x04000000  /* Snapshot is being deleted */
 #define EXT4_SNAPFILE_SHRUNK_FL                0x08000000  /* Snapshot shrink has completed */
 #define EXT4_INLINE_DATA_FL            0x10000000 /* Inode has inline data */
index ff2fcf003308b063c16e21ab6ad4b5cd138ec937..5a4928a549e07768cb135aa0c7517bfcedfc74f0 100644 (file)
@@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
 .B chattr
 changes the file attributes on a Linux file system.
 .PP
-The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
+The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
 .PP
 The operator '+' causes the selected attributes to be added to the
 existing attributes of the files; '-' causes them to be removed; and '='
 causes them to be the only attributes that the files have.
 .PP
-The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
+The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
 append only (a),
 no atime updates (A),
 compressed (c),
@@ -45,7 +45,8 @@ secure deletion (s),
 synchronous updates (S),
 no tail-merging (t),
 top of directory hierarchy (T),
-and undeletable (u).
+undeletable (u),
+and direct access for files (x).
 .PP
 The following attributes are read-only, and may be listed by
 .BR lsattr (1)
@@ -210,6 +211,14 @@ saved.  This allows the user to ask for its undeletion.  Note: please
 make sure to read the bugs and limitations section at the end of this
 document.
 .TP
+.B x
+The 'x' attribute can be set on a directory or file.  If the attribute
+is set on an existing directory, it will be inherited by all files and
+subdirectories that are subsequently created in the directory.  If an
+existing directory has contained some files and subdirectories, modifying
+the attribute on the parent directory doesn't change the attributes on
+these files and subdirectories.
+.TP
 .B V
 A file with the 'V' attribute set has fs-verity enabled.  It cannot be
 written to, and the filesystem will automatically verify all data read
index a5d60170bdb64b0e70e61d1df136d55766678550..c0337f86beed3e549a12816e1e012852450a3f99 100644 (file)
@@ -86,7 +86,7 @@ static unsigned long sf;
 static void usage(void)
 {
        fprintf(stderr,
-               _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
+               _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
                program_name);
        exit(1);
 }
@@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
        { EXT2_NOTAIL_FL, 't' },
        { EXT2_TOPDIR_FL, 'T' },
        { FS_NOCOW_FL, 'C' },
+       { FS_DAX_FL, 'x' },
        { EXT4_CASEFOLD_FL, 'F' },
        { 0, 0 }
 };