Blame SOURCES/xfsprogs-4.12.0-mkfs.xfs-allow-specification-of-0-data-stripe-width-.patch

e59f31
From 746d40a73162f942f63f6a2f612f491d107b9824 Mon Sep 17 00:00:00 2001
e59f31
From: Eric Sandeen <sandeen@redhat.com>
e59f31
Date: Thu, 20 Jul 2017 10:51:34 -0500
e59f31
Subject: [PATCH] mkfs.xfs: allow specification of 0 data stripe width & unit
e59f31
e59f31
The "noalign" option works for this too, but it seems reasonable
e59f31
to allow explicit specification of stripe unit and stripe width
e59f31
to 0; today, doing so today makes the code think it's unspecified,
e59f31
and so it goes ahead and detects stripe geometry and sets it in the
e59f31
superblock.  That's unexpected and surprising.
e59f31
e59f31
Create a new flag that tracks whtether a geometry option has been
e59f31
specified, and if it's set along with 0 values, treat it the
e59f31
same as if "noalign" had been specified.
e59f31
e59f31
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
e59f31
Reviewed-by: Christoph Hellwig <hch@lst.de>
e59f31
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
e59f31
---
e59f31
 mkfs/xfs_mkfs.c | 11 ++++++++++-
e59f31
 1 file changed, 10 insertions(+), 1 deletion(-)
e59f31
e59f31
Index: xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
e59f31
===================================================================
e59f31
--- xfsprogs-rhel7.5.orig/mkfs/xfs_mkfs.c
e59f31
+++ xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
e59f31
@@ -909,6 +909,7 @@ main(
e59f31
 	int			dsw;
e59f31
 	int			dsunit;
e59f31
 	int			dswidth;
e59f31
+	int			dsflag;
e59f31
 	int			force_overwrite;
e59f31
 	struct fsxattr		fsx;
e59f31
 	int			iaflag;
e59f31
@@ -1012,7 +1013,7 @@ main(
e59f31
 	dfile = logfile = rtfile = NULL;
e59f31
 	dsize = logsize = rtsize = rtextsize = protofile = NULL;
e59f31
 	dsu = dsw = dsunit = dswidth = lalign = lsu = lsunit = 0;
e59f31
-	nodsflag = norsflag = 0;
e59f31
+	dsflag = nodsflag = norsflag = 0;
e59f31
 	force_overwrite = 0;
e59f31
 	worst_freelist = 0;
e59f31
 	lazy_sb_counters = 1;
e59f31
@@ -1137,6 +1138,7 @@ main(
e59f31
 						exit(1);
e59f31
 					}
e59f31
 					dsunit = cvtnum(0, 0, value);
e59f31
+					dsflag = 1;
e59f31
 					break;
e59f31
 				case D_SWIDTH:
e59f31
 					if (!value || *value == '\0')
e59f31
@@ -1153,6 +1155,7 @@ main(
e59f31
 						exit(1);
e59f31
 					}
e59f31
 					dswidth = cvtnum(0, 0, value);
e59f31
+					dsflag = 1;
e59f31
 					break;
e59f31
 				case D_SU:
e59f31
 					if (!value || *value == '\0')
e59f31
@@ -1164,6 +1167,7 @@ main(
e59f31
 							 D_SU);
e59f31
 					dsu = cvtnum(
e59f31
 						blocksize, sectorsize, value);
e59f31
+					dsflag = 1;
e59f31
 					break;
e59f31
 				case D_SW:
e59f31
 					if (!value || *value == '\0')
e59f31
@@ -1180,6 +1184,7 @@ main(
e59f31
 						exit(1);
e59f31
 					}
e59f31
 					dsw = cvtnum(0, 0, value);
e59f31
+					dsflag = 1;
e59f31
 					break;
e59f31
 				case D_NOALIGN:
e59f31
 					if (dsu)
e59f31
@@ -2078,6 +2083,10 @@ _("warning: sparse inodes not supported 
e59f31
 	calc_stripe_factors(dsu, dsw, sectorsize, lsu, lsectorsize,
e59f31
 				&dsunit, &dswidth, &lsunit);
e59f31
 
e59f31
+	/* If sunit & swidth were manually specified as 0, same as noalign */
e59f31
+	if (dsflag && !dsunit && !dswidth)
e59f31
+		nodsflag = 1;
e59f31
+
e59f31
 	xi.setblksize = sectorsize;
e59f31
 
e59f31
 	/*