All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: linux-block@vger.kernel.org, Omar Sandoval <osandov@fb.com>
Cc: Omar Sandoval <osandov@osandov.com>,
	Damien Le Moal <Damien.LeMoal@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function
Date: Thu,  1 Oct 2020 19:15:29 +0900	[thread overview]
Message-ID: <20201001101531.333879-2-shinichiro.kawasaki@wdc.com> (raw)
In-Reply-To: <20201001101531.333879-1-shinichiro.kawasaki@wdc.com>

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(+)

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"
-- 
2.26.2


  reply	other threads:[~2020-10-01 10:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 10:15 [PATCH blktests 0/3] Support max_active_zones Shin'ichiro Kawasaki
2020-10-01 10:15 ` Shin'ichiro Kawasaki [this message]
2020-10-01 10:26   ` [PATCH blktests 1/3] common/rc: Add _test_dev_max_active_zones() helper function Johannes Thumshirn
2020-10-01 10:15 ` [PATCH blktests 2/3] block/004: Provide max_active_zones to fio command Shin'ichiro Kawasaki
2020-10-01 10:25   ` Johannes Thumshirn
2020-10-01 10:41     ` Shinichiro Kawasaki
2020-10-01 10:43       ` Johannes Thumshirn
2020-10-01 10:15 ` [PATCH blktests 3/3] zbd/003: Reset zones when the test device has max_active_zones limit Shin'ichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201001101531.333879-2-shinichiro.kawasaki@wdc.com \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=osandov@fb.com \
    --cc=osandov@osandov.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.