[PATCH blktests v3 6/6] common/xfs: add _test_dev_suits_xfs() to verify logical block size will work

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

 



mkfs.xfs will use the sector size exposed by the device, if this
is larger than 32k this will fail as the largest sector size on XFS
is 32k. Provide a sanity check to ensure we skip creating a filesystem
if the sector size is larger than what XFS supports.

Suggested-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
---
 common/xfs      | 11 +++++++++++
 tests/block/032 |  3 ++-
 tests/nvme/012  |  1 +
 tests/nvme/035  |  1 +
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/common/xfs b/common/xfs
index 226fdbd1c83f..1342a8e61f0b 100644
--- a/common/xfs
+++ b/common/xfs
@@ -10,6 +10,17 @@ _have_xfs() {
 	_have_fs xfs && _have_program mkfs.xfs
 }
 
+_test_dev_suits_xfs() {
+	local logical_block_size
+
+	logical_block_size=$(_test_dev_queue_get logical_block_size)
+	if ((logical_block_size > 32768 )); then
+		SKIP_REASONS+=("sector size ${logical_block_size} is larger than max XFS sector size 32768")
+		return 1
+	fi
+	return 0
+}
+
 _xfs_mkfs_and_mount() {
 	local bdev=$1
 	local mount_dir=$2
diff --git a/tests/block/032 b/tests/block/032
index fc6d1a51dcad..74688f7fca6e 100755
--- a/tests/block/032
+++ b/tests/block/032
@@ -15,6 +15,7 @@ QUICK=1
 requires() {
 	_have_xfs
 	_have_module scsi_debug
+	_test_dev_suits_xfs
 }
 
 test() {
@@ -25,7 +26,7 @@ test() {
 	fi
 
 	mkdir -p "${TMPDIR}/mnt"
-	_xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" >> $FULL || return $?
+	_xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" >> "$FULL" || return $?
 	echo 1 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/delete"
 	udevadm settle
 	umount "${TMPDIR}/mnt" || return $?
diff --git a/tests/nvme/012 b/tests/nvme/012
index f9bbdca911c0..f2727c06c893 100755
--- a/tests/nvme/012
+++ b/tests/nvme/012
@@ -17,6 +17,7 @@ requires() {
 	_have_loop
 	_require_nvme_trtype_is_fabrics
 	_require_nvme_test_img_size 350m
+	_test_dev_suits_xfs
 }
 
 set_conditions() {
diff --git a/tests/nvme/035 b/tests/nvme/035
index 9f84ced53ce6..14aa8c22956b 100755
--- a/tests/nvme/035
+++ b/tests/nvme/035
@@ -14,6 +14,7 @@ requires() {
 	_have_kernel_option NVME_TARGET_PASSTHRU
 	_have_xfs
 	_have_fio
+	_test_dev_suits_xfs
 }
 
 device_requires() {
-- 
2.45.2





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux