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

Shin'ichiro Kawasaki
2020-07-28T10:15:02Z

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

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