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 <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20230719105756.553146-10-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
# 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