diff mbox series

[blktests,5/5] zbd/002: Check write pointers only when zones have valid conditions

Message ID 20200728101452.19309-6-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Support zone capacity | expand

Commit Message

Shin'ichiro Kawasaki July 28, 2020, 10:14 a.m. UTC
Per ZBC, ZAC and ZNS specifications, when zones have condition "read
only", "full" or "offline", the zones may not have valid write pointers.
In such a case, do not check validity of write pointers.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/zbd/002 | 7 +++++--
 tests/zbd/rc  | 2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Johannes Thumshirn July 28, 2020, 10:47 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Klaus Jensen July 28, 2020, 7:20 p.m. UTC | #2
On Jul 28 19:14, Shin'ichiro Kawasaki wrote:
> Per ZBC, ZAC and ZNS specifications, when zones have condition "read
> only", "full" or "offline", the zones may not have valid write pointers.
> In such a case, do not check validity of write pointers.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---

LGTM.

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
diff mbox series

Patch

diff --git a/tests/zbd/002 b/tests/zbd/002
index a134434..39c2ad5 100755
--- a/tests/zbd/002
+++ b/tests/zbd/002
@@ -80,9 +80,12 @@  _check_blkzone_report() {
 		fi
 
 		# Check write pointer
-		if [[ ${wptr} -lt 0 || ${wptr} -gt ${len} ]]; then
+		if ((cond != ZONE_COND_READ_ONLY &&
+		     cond != ZONE_COND_FULL &&
+		     cond != ZONE_COND_OFFLINE &&
+		     (wptr < 0 || wptr > len) )); then
 			echo -n "Write pointer is invalid at zone ${idx}. "
-			echo "wp:${wptr}"
+			echo "wp:${wptr}, cond:${cond}"
 			return 1
 		fi
 
diff --git a/tests/zbd/rc b/tests/zbd/rc
index 3fd2d36..1237363 100644
--- a/tests/zbd/rc
+++ b/tests/zbd/rc
@@ -41,7 +41,9 @@  export ZONE_TYPE_SEQ_WRITE_PREFERRED=3
 export ZONE_COND_EMPTY=1
 export ZONE_COND_IMPLICIT_OPEN=2
 export ZONE_COND_CLOSED=4
+export ZONE_COND_READ_ONLY=13
 export ZONE_COND_FULL=14
+export ZONE_COND_OFFLINE=15
 
 export ZONE_TYPE_ARRAY=(
 	[1]="CONVENTIONAL"