Linux-Block Archive on lore.kernel.org
 help / color / 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/5] zbd/rc: Support zone capacity report by blkzone
Date: Tue, 28 Jul 2020 19:14:48 +0900
Message-ID: <20200728101452.19309-2-shinichiro.kawasaki@wdc.com> (raw)
In-Reply-To: <20200728101452.19309-1-shinichiro.kawasaki@wdc.com>

Linux kernel 5.9 zone descriptor interface added the new zone capacity
field defining the range of sectors usable within a zone. The blkzone
tool recently supported the zone capacity in its report zone feature.
Modify the helper function _get_blkzone_report() to support the zone
capacity field.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/zbd/rc | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/tests/zbd/rc b/tests/zbd/rc
index 3124693..dafd130 100644
--- a/tests/zbd/rc
+++ b/tests/zbd/rc
@@ -104,6 +104,7 @@ _put_sysfs_variable() {
 # until put function call.
 _get_blkzone_report() {
 	local target_dev=${1}
+	local cap_idx wptr_idx conds_idx type_idx
 
 	# Initialize arrays to store parsed blkzone reports.
 	# Number of reported zones is set in REPORTED_COUNT.
@@ -111,6 +112,7 @@ _get_blkzone_report() {
 	# to simplify loop operation.
 	ZONE_STARTS=()
 	ZONE_LENGTHS=()
+	ZONE_CAPS=()
 	ZONE_WPTRS=()
 	ZONE_CONDS=()
 	ZONE_TYPES=()
@@ -123,6 +125,17 @@ _get_blkzone_report() {
 		return $?
 	fi
 
+	cap_idx=3
+	wptr_idx=5
+	conds_idx=11
+	type_idx=13
+	if grep -qe "cap 0x" "${TMP_REPORT_FILE}"; then
+		cap_idx=5
+		wptr_idx=7
+		conds_idx=13
+		type_idx=15
+	fi
+
 	local _IFS=$IFS
 	local -i loop=0
 	IFS=$' ,:'
@@ -130,9 +143,10 @@ _get_blkzone_report() {
 	do
 		ZONE_STARTS+=($((_tokens[1])))
 		ZONE_LENGTHS+=($((_tokens[3])))
-		ZONE_WPTRS+=($((_tokens[5])))
-		ZONE_CONDS+=($((${_tokens[11]%\(*})))
-		ZONE_TYPES+=($((${_tokens[13]%\(*})))
+		ZONE_CAPS+=($((_tokens[cap_idx])))
+		ZONE_WPTRS+=($((_tokens[wptr_idx])))
+		ZONE_CONDS+=($((${_tokens[conds_idx]%\(*})))
+		ZONE_TYPES+=($((${_tokens[type_idx]%\(*})))
 		if [[ ${ZONE_TYPES[-1]} -eq ${ZONE_TYPE_CONVENTIONAL} ]]; then
 			(( NR_CONV_ZONES++ ))
 		fi
@@ -150,6 +164,7 @@ _get_blkzone_report() {
 	local -i max_idx=$((REPORTED_COUNT - 1))
 	ZONE_STARTS+=( $((ZONE_STARTS[max_idx] + ZONE_LENGTHS[max_idx])) )
 	ZONE_LENGTHS+=( "${ZONE_LENGTHS[max_idx]}" )
+	ZONE_CAPS+=( "${ZONE_CAPS[max_idx]}" )
 	ZONE_WPTRS+=( "${ZONE_WPTRS[max_idx]}" )
 	ZONE_CONDS+=( "${ZONE_CONDS[max_idx]}" )
 	ZONE_TYPES+=( "${ZONE_TYPES[max_idx]}" )
@@ -160,6 +175,7 @@ _get_blkzone_report() {
 _put_blkzone_report() {
 	unset ZONE_STARTS
 	unset ZONE_LENGTHS
+	unset ZONE_CAPS
 	unset ZONE_WPTRS
 	unset ZONE_CONDS
 	unset ZONE_TYPES
-- 
2.26.2


  reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 10:14 [PATCH blktests 0/5] Support zone capacity Shin'ichiro Kawasaki
2020-07-28 10:14 ` Shin'ichiro Kawasaki [this message]
2020-07-28 10:44   ` [PATCH blktests 1/5] zbd/rc: Support zone capacity report by blkzone Johannes Thumshirn
2020-07-28 19:19   ` Klaus Jensen
2020-07-28 10:14 ` [PATCH blktests 2/5] zbd/002: Check validity of zone capacity Shin'ichiro Kawasaki
2020-07-28 10:45   ` Johannes Thumshirn
2020-07-28 19:19   ` Klaus Jensen
2020-07-28 10:14 ` [PATCH blktests 3/5] zbd/004: Check zone boundary writes using zones without zone capacity gap Shin'ichiro Kawasaki
2020-07-28 10:46   ` Johannes Thumshirn
2020-07-28 19:20   ` Klaus Jensen
2020-07-28 10:14 ` [PATCH blktests 4/5] zbd/005: Enable zonemode=zbd when zone capacity is less than zone size Shin'ichiro Kawasaki
2020-07-28 10:47   ` Johannes Thumshirn
2020-07-28 19:20   ` Klaus Jensen
2020-07-28 10:14 ` [PATCH blktests 5/5] zbd/002: Check write pointers only when zones have valid conditions Shin'ichiro Kawasaki
2020-07-28 10:47   ` Johannes Thumshirn
2020-07-28 19:20   ` Klaus Jensen
2020-08-04 21:03 ` [PATCH blktests 0/5] Support zone capacity Omar Sandoval

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=20200728101452.19309-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

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git