public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xfsprogs: ignore stripe geom if sunit or swidth == physical sector size
@ 2014-10-28 17:35 Eric Sandeen
  2014-10-28 17:38 ` [PATCH 2/2] xfsprogs: don't warn about log sunit size if it was auto-discovered Eric Sandeen
  2014-10-29 18:37 ` [PATCH 1/2] xfsprogs: ignore stripe geom if sunit or swidth == physical sector size Brian Foster
  0 siblings, 2 replies; 12+ messages in thread
From: Eric Sandeen @ 2014-10-28 17:35 UTC (permalink / raw)
  To: xfs-oss, Stan Hoeppner

Today, this geometry:

# modprobe scsi_debug  opt_blks=2048 dev_size_mb=2048
# blockdev --getpbsz --getss --getiomin --getioopt  /dev/sdd
512
512
512
1048576

will result in a warning at mkfs time, like this:

# mkfs.xfs -f -d su=64k,sw=12 -l su=64k /dev/sdd
mkfs.xfs: Specified data stripe width 1536 is not the same as the volume stripe width 2048

because our geometry discovery thinks it looks like a
valid striping setup which the commandline is overriding. 
However, a stripe unit of 512 really isn't indicative of
a proper stripe geometry.

Prior to this patch, we reset only sunit *or* swidth,
if either was equal to physical block size, but not
necessarily both.

Change the heuristic so that if either the discovered
sunit or the discovered swidth is physical block size,
we reset *both* to zero and ignore the geom completely.

While we're at it, don't pass &dummy in for multiple 
arguments to blkid_get_topology(); that'll mean that
inside the function, the last assignment wins, and could
lead to unexpected results.

Reported-by: Stan Hoeppner <stan@hardwarefreak.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 4546e35..a0fed31 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -410,21 +410,27 @@ static void blkid_get_topology(
 	*lsectorsize = val;
 	val = blkid_topology_get_physical_sector_size(tp);
 	*psectorsize = val;
+	val = blkid_topology_get_minimum_io_size(tp);
+	*sunit = val;
+	val = blkid_topology_get_optimal_io_size(tp);
+	*swidth = val;
 
 	/*
-	 * Blkid reports the information in terms of bytes, but we want it in
-	 * terms of 512 bytes blocks (just to convert it to bytes later..)
-	 *
 	 * If the reported values are the same as the physical sector size
-	 * do not bother to report anything.  It will just cause warnings
+	 * do not bother to report anything.  It will only cause warnings
 	 * if people specify larger stripe units or widths manually.
 	 */
-	val = blkid_topology_get_minimum_io_size(tp);
-	if (val > *psectorsize)
-		*sunit = val >> 9;
-	val = blkid_topology_get_optimal_io_size(tp);
-	if (val > *psectorsize)
-		*swidth = val >> 9;
+	if (*sunit == *psectorsize || *swidth == *psectorsize) {
+		*sunit = 0;
+		*swidth = 0;
+	}
+
+	/*
+	 * Blkid reports the information in terms of bytes, but we want it in
+	 * terms of 512 bytes blocks (only to convert it to bytes later..)
+	 */
+	*sunit = *sunit >> 9;
+	*swidth = *swidth >> 9;	
 
 	if (blkid_topology_get_alignment_offset(tp) != 0) {
 		fprintf(stderr,
@@ -484,10 +490,10 @@ static void get_topology(
 	}
 
 	if (xi->rtname && !xi->risfile) {
-		int dummy;
+		int sunit, lsectorsize, psectorsize;
 
-		blkid_get_topology(xi->rtname, &dummy, &ft->rtswidth,
-				   &dummy, &dummy, force_overwrite);
+		blkid_get_topology(xi->rtname, &sunit, &ft->rtswidth,
+				   &lsectorsize, &psectorsize, force_overwrite);
 	}
 }
 #else /* ENABLE_BLKID */

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2014-10-30 20:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-28 17:35 [PATCH 1/2] xfsprogs: ignore stripe geom if sunit or swidth == physical sector size Eric Sandeen
2014-10-28 17:38 ` [PATCH 2/2] xfsprogs: don't warn about log sunit size if it was auto-discovered Eric Sandeen
2014-10-29 18:38   ` Brian Foster
2014-10-29 18:45     ` Eric Sandeen
2014-10-29 19:57       ` Brian Foster
2014-10-29 18:37 ` [PATCH 1/2] xfsprogs: ignore stripe geom if sunit or swidth == physical sector size Brian Foster
2014-10-29 18:47   ` Eric Sandeen
2014-10-29 21:38     ` Stan Hoeppner
2014-10-30 11:46       ` Brian Foster
2014-10-30 19:15         ` Stan Hoeppner
2014-10-30 19:50           ` Brian Foster
2014-10-30 20:15             ` Stan Hoeppner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox