[PATCH] mkfs.xfs: don't detect geometry values <= physblk size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



blkid_get_topology() ignores devices which report 512
as their minimum & optimal IO size, but we should ignore
anything up to the physical block size; otherwise
4k devices will report a "stripe size" of 4k, and warn
if anything larger is specified:

# modprobe scsi_debug physblk_exp=3 num_parts=2 dev_size_mb=128
# mdadm --create /dev/md1 --level=0 --raid-devices=2  -c 4 /dev/sdb1 /dev/sdb2
# mkfs.xfs -f -d su=16k,sw=2 /dev/md1
mkfs.xfs: Specified data stripe unit 32 is not the same as the volume stripe unit 8
mkfs.xfs: Specified data stripe width 64 is not the same as the volume stripe width 16
...

but a stripe unit of 4k is pretty nonsensical.  And that's even chosen by
default in this case, which is maybe even worse?

# mkfs.xfs -f /dev/md1 
meta-data=/dev/md1               isize=256    agcount=2, agsize=8125 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=16249, imaxpct=25
         =                       sunit=1      swidth=8 blks
...

We can rearrange things a bit, get the physical block size first,
and then ignore reported minimum/optimal sizes which is no larger
than that.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 577880b..386d1d6 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -396,25 +396,25 @@ static void blkid_get_topology(
 	if (!tp)
 		goto out_free_probe;
 
+	val = blkid_topology_get_logical_sector_size(tp);
+	*lsectorsize = val;
+	val = blkid_topology_get_physical_sector_size(tp);
+	*psectorsize = 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 just the normal 512 byte block size
-	 * do not bother to report anything.  It will just causes warnings
-	 * if people specifier larger stripe units or widths manually.
+	 * If the reported values are the same as the physical block size
+	 * do not bother to report anything.  It will just cause warnings
+	 * if people specify larger stripe units or widths manually.
 	 */
-	val = blkid_topology_get_minimum_io_size(tp) >> 9;
-	if (val > 1)
-		*sunit = val;
-	val = blkid_topology_get_optimal_io_size(tp) >> 9;
-	if (val > 1)
-		*swidth = val;
-
-	val = blkid_topology_get_logical_sector_size(tp);
-	*lsectorsize = val;
-	val = blkid_topology_get_physical_sector_size(tp);
-	*psectorsize = val;
+	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 (blkid_topology_get_alignment_offset(tp) != 0) {
 		fprintf(stderr,


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


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux