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 2/5] zbd/002: Check validity of zone capacity
Date: Tue, 28 Jul 2020 19:14:49 +0900
Message-ID: <20200728101452.19309-3-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. Add a check to
ensure that the zone capacity is smaller than or equal to the zone size.

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

diff --git a/tests/zbd/002 b/tests/zbd/002
index e197827..a134434 100755
--- a/tests/zbd/002
+++ b/tests/zbd/002
@@ -24,6 +24,7 @@ _check_blkzone_report() {
 	local -i cur_start=${ZONE_STARTS[0]}
 	local -i next_start=0
 	local -i len=0
+	local -i cap=0
 	local -i wptr=0
 	local -i cond=0
 	local -i zone_type=0
@@ -50,6 +51,7 @@ _check_blkzone_report() {
 
 		next_start=${ZONE_STARTS[$((idx+1))]}
 		len=${ZONE_LENGTHS[$idx]}
+		cap=${ZONE_CAPS[$idx]}
 		wptr=${ZONE_WPTRS[$idx]}
 		cond=${ZONE_CONDS[$idx]}
 		zone_type=${ZONE_TYPES[$idx]}
@@ -70,6 +72,13 @@ _check_blkzone_report() {
 			return 1
 		fi
 
+		# Check zone capacity
+		if [[ ${cap} -gt ${len} ]]; then
+			echo -n "Zone capacity is invalid at zone ${idx}. "
+			echo "capacity: ${cap}, size: ${len}"
+			return 1
+		fi
+
 		# Check write pointer
 		if [[ ${wptr} -lt 0 || ${wptr} -gt ${len} ]]; then
 			echo -n "Write pointer is invalid at zone ${idx}. "
-- 
2.26.2


  parent reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 10:14 [PATCH blktests 0/5] Support " Shin'ichiro Kawasaki
2020-07-28 10:14 ` [PATCH blktests 1/5] zbd/rc: Support zone capacity report by blkzone Shin'ichiro Kawasaki
2020-07-28 10:44   ` Johannes Thumshirn
2020-07-28 19:19   ` Klaus Jensen
2020-07-28 10:14 ` Shin'ichiro Kawasaki [this message]
2020-07-28 10:45   ` [PATCH blktests 2/5] zbd/002: Check validity of zone capacity 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-3-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