From: Shin'ichiro Kawasaki Date: Wed, 13 Oct 2021 06:09:03 +0000 (+0900) Subject: t/zbd: Add -w option to ensure no open zone before write tests X-Git-Tag: fio-3.29~54 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ccf9d1efdae8a440fff750037117428f27e40b43;p=fio.git t/zbd: Add -w option to ensure no open zone before write tests The commit b34eb155e4a6 ("t/zbd: Reset all zones before test when max open zones is specified") introduced -o max_open_zones option to the script t/zbd/test-zbd-support. It passes max_open_zones value to fio and resets all zones of the test target device before each test case run with write operation. This zone reset by the script ensures that no zone out of the IO range is in open status and the write operation do not exceed the max_open_zones limit. On the other hand, since commit d2f442bc0bd5 ("ioengines: add get_max_open_zones zoned block device operation"), fio automatically fetches the max_open_zones value. So it is no longer required to pass the max_open_zones value from the script to fio. To simplify the script usage, introduce -w option which does not require max_open_zones value. This option just resets zones before test cases with write operation. Of note is that fio itself resets the zones exceeding max_open_zones limit since the commit 954217b90191 ("zbd: Initialize open zones list referring zone status at fio start"), but it just resets zones within the fio IO range. Still zone reset by the test script is required for zones out of IO range. Zone reset out of IO range by fio is not implemented since it may cause unexpected data erasure. Suggested-by: Niklas Cassel Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Niklas Cassel Link: https://lore.kernel.org/r/20211013060903.166543-6-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe --- diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support index 4ee46de3..7e2fff00 100755 --- a/t/zbd/test-zbd-support +++ b/t/zbd/test-zbd-support @@ -12,6 +12,7 @@ usage() { echo -e "\t-v Run fio with valgrind --read-var-info option" echo -e "\t-l Test with libzbc ioengine" echo -e "\t-r Reset all zones before test start" + echo -e "\t-w Reset all zones before executing each write test case" echo -e "\t-o Run fio with max_open_zones limit" echo -e "\t-t Run only a single test case with specified number" echo -e "\t-q Quit the test run after any failed test" @@ -182,13 +183,14 @@ run_fio_on_seq() { run_one_fio_job "${opts[@]}" "$@" } -# Prepare for write test by resetting zones. When max_open_zones option is -# specified, reset all zones of the test target to ensure that zones out of the -# test target range do not have open zones. This allows the write test to the -# target range to be able to open zones up to max_open_zones. +# Prepare for write test by resetting zones. When reset_before_write or +# max_open_zones option is specified, reset all zones of the test target to +# ensure that zones out of the test target range do not have open zones. This +# allows the write test to the target range to be able to open zones up to +# max_open_zones limit specified as the option or obtained from sysfs. prep_write() { - [[ -n "${max_open_zones_opt}" && -n "${is_zbd}" ]] && - reset_zone "${dev}" -1 + [[ -n "${reset_before_write}" || -n "${max_open_zones_opt}" ]] && + [[ -n "${is_zbd}" ]] && reset_zone "${dev}" -1 } SKIP_TESTCASE=255 @@ -1247,6 +1249,7 @@ SECONDS=0 tests=() dynamic_analyzer=() reset_all_zones= +reset_before_write= use_libzbc= zbd_debug= max_open_zones_opt= @@ -1261,6 +1264,7 @@ while [ "${1#-}" != "$1" ]; do shift;; -l) use_libzbc=1; shift;; -r) reset_all_zones=1; shift;; + -w) reset_before_write=1; shift;; -t) tests+=("$2"); shift; shift;; -o) max_open_zones_opt="${2}"; shift; shift;; -v) dynamic_analyzer=(valgrind "--read-var-info=yes");