]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: allow setting dax flag on root directory
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 17 Aug 2020 21:20:17 +0000 (17:20 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 17 Aug 2020 21:20:17 +0000 (17:20 -0400)
Teach mkfs to set the DAX flag on the root directory so that all new
files can be created in dax mode.  This is a complement to removing the
mount option.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
man/man8/mkfs.xfs.8
mkfs/xfs_mkfs.c

index 7d3f3552ff12375a24ae91b2db99c696f4da0d06..0a7858748457a570b6a23f2c1029267cdfe94918 100644 (file)
@@ -398,6 +398,16 @@ will have this extent size hint applied.
 The value must be provided in units of filesystem blocks.
 Directories will pass on this hint to newly created regular files and
 directories.
+.TP
+.BI daxinherit= value
+If set, all inodes created by
+.B mkfs.xfs
+will be created with the DAX flag set.
+Directories will pass on this flag to newly created regular files and
+directories.
+By default,
+.B mkfs.xfs
+will not enable DAX mode.
 .RE
 .TP
 .B \-f
index 2e6cd280e388a981b2bda2779fdd3477be6ece2b..a687f385a9c1527fda64a3c901e017e342a20993 100644 (file)
@@ -60,6 +60,7 @@ enum {
        D_PROJINHERIT,
        D_EXTSZINHERIT,
        D_COWEXTSIZE,
+       D_DAXINHERIT,
        D_MAX_OPTS,
 };
 
@@ -254,6 +255,7 @@ static struct opt_params dopts = {
                [D_PROJINHERIT] = "projinherit",
                [D_EXTSZINHERIT] = "extszinherit",
                [D_COWEXTSIZE] = "cowextsize",
+               [D_DAXINHERIT] = "daxinherit",
        },
        .subopt_params = {
                { .index = D_AGCOUNT,
@@ -369,6 +371,12 @@ static struct opt_params dopts = {
                  .maxval = UINT_MAX,
                  .defaultval = SUBOPT_NEEDS_VAL,
                },
+               { .index = D_DAXINHERIT,
+                 .conflicts = { { NULL, LAST_CONFLICT } },
+                 .minval = 0,
+                 .maxval = 1,
+                 .defaultval = 1,
+               },
        },
 };
 
@@ -1434,6 +1442,12 @@ data_opts_parser(
                cli->fsx.fsx_cowextsize = getnum(value, opts, subopt);
                cli->fsx.fsx_xflags |= FS_XFLAG_COWEXTSIZE;
                break;
+       case D_DAXINHERIT:
+               if (getnum(value, opts, subopt))
+                       cli->fsx.fsx_xflags |= FS_XFLAG_DAX;
+               else
+                       cli->fsx.fsx_xflags &= ~FS_XFLAG_DAX;
+               break;
        default:
                return -EINVAL;
        }