Thread (16 messages) 16 messages, 3 authors, 2025-02-21

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

From: Shinichiro Kawasaki <hidden>
Date: 2025-02-14 11:29:00
Also in: linux-patches

On Feb 12, 2025 / 12:54, Luis Chamberlain wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 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
I don't think this check is needed.

_test_dev_suits_xfs() calls _test_dev_queue_get(), which works only for test
cases with test_device(). Then, it works for nvme/035. But does not work for
either block/032 or nvme/012, which prepares test target device in test(),
so they do not need the check.
quoted hunk ↗ jump to hunk
 }
 
 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
Same here.
quoted hunk ↗ jump to hunk
 }
 
 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
This is the requirement check for TEST_DEV, so I suggest to move it from
requires() to device_requires().
 }
 
 device_requires() {
-- 
2.45.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help