From 63b96224b94b5fc52b64be0c4fd2daea250dde3e Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Tue, 28 Jul 2020 19:14:50 +0900 Subject: [PATCH] zbd/004: Check zone boundary writes using zones without zone capacity gap The test case zbd/004 checks zone boundary write handling by block layer using two contiguous sequential write required zones. This test is valid when the first zone has same zone capacity as zone size. However, if the zone has zone capacity smaller than zone size, the write in the zone beyond zone capacity limit causes write error and the test fails. To avoid the write error, find the two zones with first zone that has zone capacity same as zone size. If such zones are not found, skip the test case. Reviewed-by: Johannes Thumshirn Reviewed-by: Klaus Jensen Signed-off-by: Shin'ichiro Kawasaki --- tests/zbd/004 | 6 +++++- tests/zbd/rc | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/zbd/004 b/tests/zbd/004 index ac0cf50..f09ee31 100755 --- a/tests/zbd/004 +++ b/tests/zbd/004 @@ -46,7 +46,11 @@ test_device() { # Find target sequential required zones and reset write pointers _get_blkzone_report "${TEST_DEV}" || return $? - idx=$(_find_two_contiguous_seq_zones) || return $? + if ! idx=$(_find_two_contiguous_seq_zones cap_eq_len); then + SKIP_REASON="No contiguous sequential write required zones" + _put_blkzone_report + return + fi _reset_zones "${TEST_DEV}" "${idx}" "2" # Confirm the zones are initialized diff --git a/tests/zbd/rc b/tests/zbd/rc index dafd130..3fd2d36 100644 --- a/tests/zbd/rc +++ b/tests/zbd/rc @@ -253,21 +253,28 @@ _find_sequential_zone_in_middle() { return 1 } -# Search zones and find two contiguous sequential required zones. +# Search zones and find two contiguous sequential write required zones. # Return index of the first zone of the found two zones. +# When the argument cap_eq_len is specified, find the two contiguous +# sequential write required zones with first zone that has zone capacity +# same as zone size. # Call _get_blkzone_report() beforehand. _find_two_contiguous_seq_zones() { + local cap_eq_len="${1}" local -i type_seq=${ZONE_TYPE_SEQ_WRITE_REQUIRED} for ((idx = NR_CONV_ZONES; idx < REPORTED_COUNT; idx++)); do if [[ ${ZONE_TYPES[idx]} -eq ${type_seq} && ${ZONE_TYPES[idx+1]} -eq ${type_seq} ]]; then + if [[ -n ${cap_eq_len} ]] && + ((ZONE_CAPS[idx] != ZONE_LENGTHS[idx])); then + continue + fi echo "${idx}" return 0 fi done - echo "Contiguous sequential write required zones not found" return 1 } -- 2.50.1