From ec1b42e6d58dcb7cfc5de6fc825832944997e176 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 6 Jun 2019 08:58:55 -0500 Subject: [PATCH] mkfs: enable reflink by default Data block sharing (a.k.a. reflink) has been stable for a while, so turn it on by default. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen [sandeen: update comments & man page] Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- man/man8/mkfs.xfs.8 | 9 ++++++++- mkfs/xfs_mkfs.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index 4b8c78c37..78b150155 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -231,7 +231,7 @@ available for the data forks of regular files. .IP By default, .B mkfs.xfs -will not create reference count btrees and therefore will not enable the +will create reference count btrees and therefore will enable the reflink feature. This feature is only available for filesystems created with the (default) .B \-m crc=1 @@ -239,6 +239,13 @@ option set. When the option .B \-m crc=0 is used, the reference count btree feature is not supported and reflink is disabled. +.IP +Note: the filesystem DAX mount option ( +.B \-o dax +) is incompatible with +reflink-enabled XFS filesystems. To use filesystem DAX with XFS, specify the +.B \-m reflink=0 +option to mkfs.xfs to disable the reflink feature. .RE .TP .BI \-d " data_section_options" diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 091066485..ddb25ecc5 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1973,15 +1973,15 @@ _("Directory ftype field always enabled on CRC enabled filesystems\n")); usage(); } - } else { + } else { /* !crcs_enabled */ /* - * The kernel doesn't currently support crc=0,finobt=1 - * filesystems. If crcs are not enabled and the user has not - * explicitly turned finobt on, then silently turn it off to - * avoid an unnecessary warning. + * The kernel doesn't support crc=0,finobt=1 filesystems. + * If crcs are not enabled and the user has not explicitly + * turned finobt on, then silently turn it off to avoid an + * unnecessary warning. * If the user explicitly tried to use crc=0,finobt=1, * then issue an error. - * The same is also for sparse inodes. + * The same is also true for sparse inodes and reflink. */ if (cli->sb_feat.finobt && cli_opt_set(&mopts, M_FINOBT)) { fprintf(stderr, @@ -2004,7 +2004,7 @@ _("rmapbt not supported without CRC support\n")); } cli->sb_feat.rmapbt = false; - if (cli->sb_feat.reflink) { + if (cli->sb_feat.reflink && cli_opt_set(&mopts, M_REFLINK)) { fprintf(stderr, _("reflink not supported without CRC support\n")); usage(); @@ -3876,7 +3876,7 @@ main( .finobt = true, .spinodes = true, .rmapbt = false, - .reflink = false, + .reflink = true, .parent_pointers = false, .nodalign = false, .nortalign = false, -- 2.47.2