_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
--- /dev/null
+#!/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"
+}
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.