linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: shinichiro.kawasaki@wdc.com
Cc: linux-block@vger.kernel.org, hare@suse.de,
	patches@lists.linux.dev, gost.dev@samsung.com, mcgrof@kernel.org
Subject: [PATCH blktests v3 6/6] common/xfs: add _test_dev_suits_xfs() to verify logical block size will work
Date: Wed, 12 Feb 2025 12:54:48 -0800	[thread overview]
Message-ID: <20250212205448.2107005-7-mcgrof@kernel.org> (raw)
In-Reply-To: <20250212205448.2107005-1-mcgrof@kernel.org>

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@wdc.com>
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
 }
 
 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


  parent reply	other threads:[~2025-02-12 20:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 20:54 [PATCH blktests v3 0/6] enable bs > ps device testing Luis Chamberlain
2025-02-12 20:54 ` [PATCH blktests v3 1/6] common/xfs: ignore first umount error on _xfs_mkfs_and_mount() Luis Chamberlain
2025-02-12 20:58   ` Bart Van Assche
2025-02-12 21:07     ` Luis Chamberlain
2025-02-14 11:02       ` Shinichiro Kawasaki
2025-02-12 20:54 ` [PATCH blktests v3 2/6] block/032: make error messages clearer if mkfs or mount fails Luis Chamberlain
2025-02-14 11:06   ` Shinichiro Kawasaki
2025-02-12 20:54 ` [PATCH blktests v3 3/6] common: add and use min io for fio Luis Chamberlain
2025-02-14 11:24   ` Shinichiro Kawasaki
2025-02-12 20:54 ` [PATCH blktests v3 4/6] common/xfs: use min io for fs blocksize Luis Chamberlain
2025-02-12 20:54 ` [PATCH blktests v3 5/6] tests: use test device min io to support bs > ps Luis Chamberlain
2025-02-12 20:54 ` Luis Chamberlain [this message]
2025-02-14 11:28   ` [PATCH blktests v3 6/6] common/xfs: add _test_dev_suits_xfs() to verify logical block size will work Shinichiro Kawasaki
2025-02-14 11:34 ` [PATCH blktests v3 0/6] enable bs > ps device testing Shinichiro Kawasaki
2025-02-14 18:54   ` Luis Chamberlain
2025-02-21  9:55     ` Shinichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250212205448.2107005-7-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).