Archive-only list for patches
 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 v2 4/4] common/xfs: check for max supported sector size
Date: Tue,  4 Feb 2025 14:57:29 -0800	[thread overview]
Message-ID: <20250204225729.422949-5-mcgrof@kernel.org> (raw)
In-Reply-To: <20250204225729.422949-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.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 common/xfs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/xfs b/common/xfs
index 8b068837fa37..dbae572e4390 100644
--- a/common/xfs
+++ b/common/xfs
@@ -15,11 +15,18 @@ _xfs_mkfs_and_mount() {
 	local mount_dir=$2
 	local bs=$(_min_io $bdev)
 	local xfs_logsize="64m"
+	local sysfs="/sys/block/${bdev#/dev/}"
+	local logical_block_size=$(cat $sysfs/queue/logical_block_size)
 
 	if [[ $bs -gt 4096 ]]; then
 		xfs_logsize="128m"
 	fi
 
+	if [[ $logical_block_size -gt 32768 ]]; then
+		SKIP_REASONS+=("max sector size for XFS is 32768 but device $bdev has a larger sector size $logical_block_size")
+		return 1
+	fi
+
 	mkdir -p "${mount_dir}"
 	umount "${mount_dir}"
 	mkfs.xfs -l size=$xfs_logsize -f "${bdev}" -b size=$bs || return $?
-- 
2.45.2


  parent reply	other threads:[~2025-02-04 22:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 22:57 [PATCH blktests v2 0/4] enable bs > ps device testing Luis Chamberlain
2025-02-04 22:57 ` [PATCH blktests v2 1/4] common: add and use min io for fio Luis Chamberlain
2025-02-07 11:26   ` Shinichiro Kawasaki
2025-02-07 20:47     ` Luis Chamberlain
2025-02-04 22:57 ` [PATCH blktests v2 2/4] common/xfs: use min io for fs blocksize Luis Chamberlain
2025-02-04 22:57 ` [PATCH blktests v2 3/4] tests: use test device min io to support bs > ps Luis Chamberlain
2025-02-04 22:57 ` Luis Chamberlain [this message]
2025-02-07 11:58   ` [PATCH blktests v2 4/4] common/xfs: check for max supported sector size Shinichiro Kawasaki
2025-02-07 20:46     ` Luis Chamberlain
2025-02-07 11:24 ` [PATCH blktests v2 0/4] enable bs > ps device testing Shinichiro Kawasaki
2025-02-10 15:32   ` Luis Chamberlain

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=20250204225729.422949-5-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