Skip to content

Commit

Permalink
common/xfs: add _test_dev_suits_xfs() to verify logical block size wi…
Browse files Browse the repository at this point in the history
…ll work

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 <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
[Shin'ichiro: drop changes for block/032 and nvme/012]
Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
  • Loading branch information
mcgrof authored and kawasaki committed Feb 21, 2025
1 parent 71f5a5c commit 4ba3471
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions common/xfs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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
Expand Down
1 change: 1 addition & 0 deletions tests/nvme/035
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ requires() {
device_requires() {
_require_test_dev_is_not_nvme_multipath
_require_test_dev_size "${NVME_IMG_SIZE}"
_test_dev_suits_xfs
}

set_conditions() {
Expand Down

0 comments on commit 4ba3471

Please sign in to comment.