]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
zbd/006: Test revalidate during other I/O requests
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 14 Mar 2019 03:46:33 +0000 (12:46 +0900)
committerOmar Sandoval <osandov@fb.com>
Thu, 21 Mar 2019 22:03:45 +0000 (15:03 -0700)
Since SCSI scanning occurs asynchronously, the kernel function
blk_revalidate_disk_zones() called from sd_revalidate_disk() may be
executed while write I/Os are ongoing. As a result,
blk_revalidate_disk_zones() must not cause write I/O errors by changing
zone related parameters of the device queue unless the disk has changed.
This patch allows checking this behavior and catch regressions such as
fixed by commit ccce20fc7968 ("scsi: sd_zbc: Avoid that resetting a zone
fails sporadically").

To trigger disk revalidate, fio is executed with the --loops option
causing the target device file to be closed and reopen at each loop. The
file close triggers disk revalidate and fio starts issuing I/Os before
revalidate completes, resulting in the desired simultaneous parallel
execution of write I/Os and blk_revalidate_disk_zones().

Also move the _find_first_sequential_zone() helper function from zbd/005
to zbd/rc and reuse it in the new test case for target zone selection.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/zbd/005
tests/zbd/006 [new file with mode: 0644]
tests/zbd/006.out [new file with mode: 0644]
tests/zbd/rc

index bc9cad5301c9cb09c7b871a6909defd128baf01a..65546a6f4ba3ced8a68a252759ceaa7de3feccd7 100755 (executable)
@@ -25,19 +25,6 @@ cleanup_fallback_device() {
        _exit_null_blk
 }
 
-_find_first_sequential_zone() {
-       for ((idx =  NR_CONV_ZONES; idx < REPORTED_COUNT; idx++)); do
-               if [[ ${ZONE_TYPES[idx]} -eq ${ZONE_TYPE_SEQ_WRITE_REQUIRED} ]];
-               then
-                       echo "${idx}"
-                       return 0
-               fi
-       done
-       echo "Sequential write required zone not found"
-
-       return 1
-}
-
 test_device() {
        local -i zone_idx
        local -i offset
diff --git a/tests/zbd/006 b/tests/zbd/006
new file mode 100644 (file)
index 0000000..b745acd
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Western Digital Corporation or its affiliates.
+#
+# Run fio write job with loops option to cause file close and scsi disk
+# zone revalidate in parallel with write requests.
+
+. tests/zbd/rc
+
+DESCRIPTION="revalidate"
+TIMED=1
+CAN_BE_ZONED=1
+
+requires() {
+       _have_fio_zbd_zonemode
+}
+
+fallback_device() {
+       _fallback_null_blk_zoned
+}
+
+cleanup_fallback_device() {
+       _exit_null_blk
+}
+
+test_device() {
+       local -i zone_idx
+       local -i offset
+       local -i size
+
+       echo "Running ${TEST_NAME}"
+
+       _get_blkzone_report "${TEST_DEV}" || return $?
+
+       zone_idx=$(_find_first_sequential_zone) || return $?
+       offset=$((ZONE_STARTS[zone_idx] * 512))
+       size=$((ZONE_LENGTHS[zone_idx] * 512))
+
+       blkzone reset -o "${ZONE_STARTS[zone_idx]}" "${TEST_DEV}"
+
+       _test_dev_queue_set scheduler deadline
+
+       : "${TIMEOUT:=30}"
+       FIO_PERF_FIELDS=("write io" "write iops")
+       _fio_perf --filename="${TEST_DEV}" --name zbdwo --rw=randwrite \
+                 --zonemode=zbd --direct=1 --ioengine=libaio --iodepth=8 \
+                 --bs=4k --offset="${offset}" --size="${size}" --loops=8
+
+       _put_blkzone_report
+
+       echo "Test complete"
+}
diff --git a/tests/zbd/006.out b/tests/zbd/006.out
new file mode 100644 (file)
index 0000000..ee844f7
--- /dev/null
@@ -0,0 +1,2 @@
+Running zbd/006
+Test complete
index 88538d01812c927aa8ae2c20062deb11df5adbc5..5f04c84dcda93659d7bce5e00fdf2973b6db46dd 100644 (file)
@@ -180,6 +180,19 @@ _reset_zones() {
        fi
 }
 
+_find_first_sequential_zone() {
+       for ((idx =  NR_CONV_ZONES; idx < REPORTED_COUNT; idx++)); do
+               if [[ ${ZONE_TYPES[idx]} -eq ${ZONE_TYPE_SEQ_WRITE_REQUIRED} ]];
+               then
+                       echo "${idx}"
+                       return 0
+               fi
+       done
+       echo "Sequential write required zone not found"
+
+       return 1
+}
+
 # Search zones and find two contiguous sequential required zones.
 # Return index of the first zone of the found two zones.
 # Call _get_blkzone_report() beforehand.