[PATCH] xfs/205,432,516: read sysfs for mkfs block size instead of hardcoded values

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



At present block size of 1024 is hardcoded for mkfs. This creates
problem when device block size is more than 1024. So we use sysfs values
of SCRATCH_DEV, if not found then default to 1024.

Signed-off-by: Nitesh Shetty <nj.shetty@xxxxxxxxxxx>
---
 tests/xfs/205 | 3 ++-
 tests/xfs/432 | 3 ++-
 tests/xfs/516 | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/xfs/205 b/tests/xfs/205
index 104f1f45..73e32c4d 100755
--- a/tests/xfs/205
+++ b/tests/xfs/205
@@ -22,7 +22,8 @@ _require_scratch_nocheck
 # bitmap consuming all the free space in our small data device.
 unset SCRATCH_RTDEV
 
-fsblksz=1024
+physical=$(cat /sys/block/$(_short_dev $SCRATCH_DEV)/queue/physical_block_size)
+fsblksz=${physical:-1024}
 _scratch_mkfs_xfs -d size=$((32768*fsblksz)) -b size=$fsblksz >> $seqres.full 2>&1
 _scratch_mount
 
diff --git a/tests/xfs/432 b/tests/xfs/432
index 86012f0b..cd6367e2 100755
--- a/tests/xfs/432
+++ b/tests/xfs/432
@@ -49,7 +49,8 @@ echo "Format and mount"
 # block.  8187 hashes/dablk / 248 dirents/dirblock = ~33 dirblocks per
 # dablock.  33 dirblocks * 64k mean that we can expand a directory by
 # 2112k before we have to allocate another da btree block.
-_scratch_mkfs -b size=1k -n size=64k > "$seqres.full" 2>&1
+physical=$(cat /sys/block/$(_short_dev $SCRATCH_DEV)/queue/physical_block_size)
+_scratch_mkfs -b size=${physical:-1k} -n size=64k > "$seqres.full" 2>&1
 _scratch_mount >> "$seqres.full" 2>&1
 
 metadump_file="$TEST_DIR/meta-$seq"
diff --git a/tests/xfs/516 b/tests/xfs/516
index 9e1b9931..b9d4f0c9 100755
--- a/tests/xfs/516
+++ b/tests/xfs/516
@@ -84,7 +84,8 @@ test_su_opts()
 	local mounted=0
 
 	echo "Format with 256k stripe unit; 4x stripe width" >> $seqres.full
-	_scratch_mkfs -b size=1k -d su=256k,sw=4 >> $seqres.full 2>&1
+	physical=$(cat /sys/block/$(_short_dev $SCRATCH_DEV)/queue/physical_block_size)
+	_scratch_mkfs -b size=${physical:-1k} -d su=256k,sw=4 >> $seqres.full 2>&1
 
 	__test_mount_opts "$@"
 }

base-commit: 2ea74ba4e70b546279896e2a733c8c7f4b206193
-- 
2.25.1




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux