diff mbox series

[blktests,1/3] common/rc: Add _test_dev_max_active_zones() helper function

Message ID 20201001101531.333879-2-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Support max_active_zones | expand

Commit Message

Shin'ichiro Kawasaki Oct. 1, 2020, 10:15 a.m. UTC
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.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/rc | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Johannes Thumshirn Oct. 1, 2020, 10:26 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index cdc0150..0589431 100644
--- 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"