For a random write pattern to a zoned block device, fio requires --direct=1
and --zonemode=zbd options as well as deadline I/O scheduler to be
specified. Specify these options and set the I/O scheduler if the target
device is a zoned block device. Before doing that, also make sure that the
deadline scheduler is available and that fio supports the zbd zone mode.

Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
---
 tests/block/004 | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/block/004 b/tests/block/004
index 4c14c4b..88cc083 100755
--- a/tests/block/004
+++ b/tests/block/004
@@ -16,10 +16,26 @@ requires() {
 test_device() {
        echo "Running ${TEST_NAME}"
 
+       local directio=""
+       local zbdmode=""
+
+       if _test_dev_is_zoned; then
+               if ! _have_fio_zbd_zonemode; then
+                       echo "${SKIP_REASON}"
+                       return 1
+               fi
+
+               set_scheduler "$(basename "$(readlink -f "${TEST_DEV}")")" \
+                             deadline || return $?
+
+               directio="--direct=1"
+               zbdmode="--zonemode=zbd"
+       fi
+
        FIO_PERF_FIELDS=("write iops")
        _fio_perf --bs=4k --rw=randwrite --norandommap --fsync=1 \
                --number_ios=256 --numjobs=64 --name=flushes \
-               --filename="$TEST_DEV"
+               ${directio} ${zbdmode} --filename="$TEST_DEV"
 
        echo "Test complete"
 }
-- 
2.20.1

Reply via email to