linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mkfs.xfs: allow specification of 0 data stripe width & unit
@ 2017-06-16 17:55 Eric Sandeen
  2017-06-20  9:04 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2017-06-16 17:55 UTC (permalink / raw)
  To: linux-xfs; +Cc: Jan Tulak

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>
---

I suppose another option would be to disallow 0 values; that
would eliminate the flag and the extra logic and could be handled
in all of the value-checking code that exists.  I'm ok either
way, although 0 has been accepted up until now, so it might
be best to not change that.

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 930f3d2..874033e 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1422,6 +1422,7 @@ main(
 	int			dsw;
 	int			dsunit;
 	int			dswidth;
+	int			dsflag;
 	int			force_overwrite;
 	struct fsxattr		fsx;
 	int			ilflag;
@@ -1524,7 +1525,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));
@@ -1590,16 +1591,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,
@@ -2306,6 +2311,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;
 
 	/*


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mkfs.xfs: allow specification of 0 data stripe width & unit
  2017-06-16 17:55 [PATCH] mkfs.xfs: allow specification of 0 data stripe width & unit Eric Sandeen
@ 2017-06-20  9:04 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2017-06-20  9:04 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs, Jan Tulak

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-20  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-16 17:55 [PATCH] mkfs.xfs: allow specification of 0 data stripe width & unit Eric Sandeen
2017-06-20  9:04 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).