t/zbd: add test case to confirm no write with rwmixwrite=0 option
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 20 Dec 2023 00:58:46 +0000 (09:58 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 20 Dec 2023 02:52:35 +0000 (19:52 -0700)
The previous commit fixed the issue of the unexpected write with options
zonemode=zbd, rw=randrw and rwmixwrite=0. Add a test to confirm the fix.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20231220005846.1371456-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/zbd/test-zbd-support

index 2f15a1913522c32f9f8fbabd45bbb448bb48b369..532860ebc86d6b59300fcbb6c3f0515316065ba8 100755 (executable)
@@ -1561,6 +1561,29 @@ test67() {
        grep -q 'Exceeded max_active_zones limit' "${logfile}.${test_number}"
 }
 
+# Test rw=randrw and rwmixwrite=0 options do not issue write I/O unit
+test68() {
+       local off size
+
+       require_zbd || return "$SKIP_TESTCASE"
+
+       reset_zone "${dev}" -1
+
+       # Write some data as preparation
+       off=$((first_sequential_zone_sector * 512))
+       size=$min_seq_write_size
+       run_one_fio_job "$(ioengine "psync")" --rw=write --offset="$off" \
+                       --io_size="$size" --zonemode=strided \
+                       --zonesize="$zone_size" --zonerange="$zone_size" \
+                      >> "${logfile}.${test_number}" 2>&1 || return $?
+       # Run random mixed read and write specifying zero write ratio
+       run_fio_on_seq "$(ioengine "psync")" --rw=randrw --rwmixwrite=0 \
+                      --time_based --runtime=1s \
+                      >> "${logfile}.${test_number}" 2>&1 || return $?
+       # "WRITE:" shall be recoreded only once for the preparation
+       [[ $(grep -c "WRITE:" "${logfile}.${test_number}") == 1 ]]
+}
+
 SECONDS=0
 tests=()
 dynamic_analyzer=()