From af26c9bf6992e47f5da18955e1edb2d318325db3 Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Wed, 19 Jul 2023 19:57:52 +0900 Subject: [PATCH] t/zbd: get max_open_zones from sysfs The helper bash function gets max_open_zones limit of the test target device using sg_inq and libzbc tools. This works for SAS/SATA devices but does not work for ZNS or null_blk devices. This results is running the test case 31 with wrong max_open_zones value. Fix this by referring max_open_zones sysfs attribute. Signed-off-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20230719105756.553146-10-shinichiro.kawasaki@wdc.com Signed-off-by: Vincent Fu --- t/zbd/functions | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/zbd/functions b/t/zbd/functions index 529e7944..4faa45a9 100644 --- a/t/zbd/functions +++ b/t/zbd/functions @@ -212,8 +212,14 @@ last_online_zone() { # max_open_zones in sysfs, or which lacks zoned block device support completely. max_open_zones() { local dev=$1 + local realdev syspath - if [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then + realdev=$(readlink -f "$dev") + syspath=/sys/block/${realdev##*/}/queue/max_open_zones + + if [ -b "${realdev}" ] && [ -r "${syspath}" ]; then + cat ${syspath} + elif [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" \ > /dev/null 2>&1; then # When sg_inq can not get max open zones, specify 0 which indicates -- 2.25.1