[PATCH 2/4] generic/765: Fix sysfs path for nvme partitions
Ojaswin Mujoo <[email protected]>
| Newsgroups | org.kernel.vger.fstests |
|---|---|
| Message-ID | <7fe6154353d38b2dc308db16d8125b83a8ed7daf.1775039135.git.ojaswin@linux.ibm.com> |
This tests checks atomic write limits reported by statx() are same as the ones reported by sysfs, however nvme partitions don't have the /sys/block/nvme0n1p1 style entry and also use the namespace's queue limits for atomic writes. This causes the test to fail because it expects /sys/block/nvme0n*p* to be present. Hence, in this case, just check against the parent namespace. Reported-by: Disha Goel <[email protected]> Signed-off-by: Ojaswin Mujoo <[email protected]> --- tests/generic/765 | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/generic/765 b/tests/generic/765 index 8c4e0bd0..4c768783 100755 --- a/tests/generic/765 +++ b/tests/generic/765 @@ -94,16 +94,31 @@ test_atomic_writes() _scratch_unmount } -sys_min_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_min_bytes") -sys_max_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_max_bytes") +# Get the right sysfs dev for the atomic write device +get_aw_dev() { + local dev + dev=$(_short_dev "$1") + + # Special case: nvme partitions don't have the /sys/block/nvme0n1p1 style + # entry and also use the namespace's queue limits for atomic writes, hence + # just return the parent namespace. + if [[ $dev == nvme* ]]; then + echo "${dev%%p[0-9]*}" + else + echo "$dev" + fi +} + +sys_min_write=$(cat "/sys/block/$(get_aw_dev $SCRATCH_DEV)/queue/atomic_write_unit_min_bytes") +sys_max_write=$(cat "/sys/block/$(get_aw_dev $SCRATCH_DEV)/queue/atomic_write_unit_max_bytes") bdev_min_write=$(_get_atomic_write_unit_min $SCRATCH_DEV) bdev_max_write=$(_get_atomic_write_unit_max $SCRATCH_DEV) echo "sysfs awu_min $sys_min_write" >> $seqres.full -echo "sysfs awu_min $sys_max_write" >> $seqres.full +echo "sysfs awu_max $sys_max_write" >> $seqres.full echo "bdev awu_min $bdev_min_write" >> $seqres.full -echo "bdev awu_min $bdev_max_write" >> $seqres.full +echo "bdev awu_max $bdev_max_write" >> $seqres.full # Test that statx atomic values are the same as sysfs values if [ "$sys_min_write" -ne "$bdev_min_write" ]; then -- 2.53.0