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

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