From: Shin'ichiro Kawasaki Date: Thu, 21 Feb 2019 04:11:02 +0000 (+0900) Subject: t/zbd: Fix handling of partition devices X-Git-Tag: fio-3.14~34 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=cb6ee92a7fbf7e373074409d9570dc9b27dece17;ds=sidebyside t/zbd: Fix handling of partition devices To allow t/zbd/tests-zbd-support test script to run correctly on partitions of zoned block devices, fix access to the device properties through sysfs by referencing the sysfs directory of the holder block device. Doing so, the "zoned", "logical_block_size" and "mq" attributes can be correctly accessed. Signed-off-by: Shin'ichiro Kawasaki Signed-off-by: Jens Axboe --- diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support index 2d727910..d316d880 100755 --- a/t/zbd/test-zbd-support +++ b/t/zbd/test-zbd-support @@ -761,7 +761,15 @@ source "$(dirname "$0")/functions" || exit $? dev=$1 realdev=$(readlink -f "$dev") basename=$(basename "$realdev") -disk_size=$(($(<"/sys/block/$basename/size")*512)) +major=$((0x$(stat -L -c '%t' "$realdev"))) +minor=$((0x$(stat -L -c '%T' "$realdev"))) +disk_size=$(($(<"/sys/dev/block/$major:$minor/size")*512)) +# When the target is a partition device, get basename of its holder device to +# access sysfs path of the holder device +if [[ -r "/sys/dev/block/$major:$minor/partition" ]]; then + realsysfs=$(readlink "/sys/dev/block/$major:$minor") + basename=$(basename "${realsysfs%/*}") +fi logical_block_size=$(<"/sys/block/$basename/queue/logical_block_size") case "$(<"/sys/class/block/$basename/queue/zoned")" in host-managed|host-aware)