aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2017-07-20 10:51:34 -0500
committerEric Sandeen <sandeen@redhat.com>2017-07-20 10:51:34 -0500
commit746d40a73162f942f63f6a2f612f491d107b9824 (patch)
treee40fe5eb6888f8484003f6bc29c75214ddb09d2f
parentb5fcdc06e7affb5b143b0b6e683a4abba56353f9 (diff)
downloadxfsprogs-dev-746d40a73162f942f63f6a2f612f491d107b9824.tar.gz
mkfs.xfs: allow specification of 0 data stripe width & unit
The "noalign" option works for this too, but it seems reasonable to allow explicit specification of stripe unit and stripe width to 0; today, doing so today makes the code think it's unspecified, and so it goes ahead and detects stripe geometry and sets it in the superblock. That's unexpected and surprising. Create a new flag that tracks whtether a geometry option has been specified, and if it's set along with 0 values, treat it the same as if "noalign" had been specified. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--mkfs/xfs_mkfs.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index a69190b9e8..b5c3a57e68 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1419,6 +1419,7 @@ main(
int dsw;
int dsunit;
int dswidth;
+ int dsflag;
int force_overwrite;
struct fsxattr fsx;
int ilflag;
@@ -1521,7 +1522,7 @@ main(
dfile = logfile = rtfile = NULL;
dsize = logsize = rtsize = rtextsize = protofile = NULL;
dsu = dsw = dsunit = dswidth = lalign = lsu = lsunit = 0;
- nodsflag = norsflag = 0;
+ dsflag = nodsflag = norsflag = 0;
force_overwrite = 0;
worst_freelist = 0;
memset(&fsx, 0, sizeof(fsx));
@@ -1587,16 +1588,20 @@ main(
break;
case D_SUNIT:
dsunit = getnum(value, &dopts, D_SUNIT);
+ dsflag = 1;
break;
case D_SWIDTH:
dswidth = getnum(value, &dopts,
D_SWIDTH);
+ dsflag = 1;
break;
case D_SU:
dsu = getnum(value, &dopts, D_SU);
+ dsflag = 1;
break;
case D_SW:
dsw = getnum(value, &dopts, D_SW);
+ dsflag = 1;
break;
case D_NOALIGN:
nodsflag = getnum(value, &dopts,
@@ -2303,6 +2308,10 @@ _("rmapbt not supported with realtime devices\n"));
calc_stripe_factors(dsu, dsw, sectorsize, lsu, lsectorsize,
&dsunit, &dswidth, &lsunit);
+ /* If sunit & swidth were manually specified as 0, same as noalign */
+ if (dsflag && !dsunit && !dswidth)
+ nodsflag = 1;
+
xi.setblksize = sectorsize;
/*