]> www.infradead.org Git - users/hch/blktests.git/commitdiff
common/rc: Add _test_dev_max_active_zones() helper function
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 1 Oct 2020 10:15:29 +0000 (19:15 +0900)
committerOmar Sandoval <osandov@fb.com>
Thu, 22 Oct 2020 21:36:31 +0000 (14:36 -0700)
Linux kernel 5.9 introduced a new sysfs attribute "max_active_zones". It
is an attribute of zoned block devices which indicates the limit of zones
in open or close status. To refer the attribute from test cases,
introduce the helper function _test_dev_max_active_zones(). If the
attribute is available, the function returns the attribute value.
Otherwise, returns 0 to indicate that the device does not have the limit.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
common/rc

index cdc0150ea5ea6a3c3ec1631fe88f34553e984782..0589431058a5e4b6e247859cae52a502b51110e6 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -272,6 +272,14 @@ _test_dev_is_partition() {
        [[ -n ${TEST_DEV_PART_SYSFS} ]]
 }
 
+_test_dev_max_active_zones() {
+       if [[ -r "${TEST_DEV_SYSFS}/queue/max_active_zones" ]]; then
+               _test_dev_queue_get max_active_zones
+       else
+               echo 0
+       fi
+}
+
 _require_test_dev_is_partition() {
        if ! _test_dev_is_partition; then
                SKIP_REASON="${TEST_DEV} is not a partition device"