To test read workload behavior with zonemode=zbd and zoned block devices with all zones empty, it is required to write data to the device before the read workload. To avoid repeated codes for such test preparation, introduce the helper function write_and_run_one_file_job(). It runs the write job with specified offset and size to prepare the read data, then run the specified job for read test. Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxx> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- t/zbd/test-zbd-support | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support index 1178afd4..55363357 100755 --- a/t/zbd/test-zbd-support +++ b/t/zbd/test-zbd-support @@ -109,6 +109,20 @@ run_one_fio_job() { --thread=1 --direct=1 } +write_and_run_one_fio_job() { + local r + local write_offset="${1}" + local write_size="${2}" + + shift 2 + r=$(((RANDOM << 16) | RANDOM)) + run_fio --filename="$dev" --randseed="$r" --name="write_job" --rw=write \ + "$(ioengine "psync")" --bs="${logical_block_size}" \ + --zonemode=zbd --zonesize="${zone_size}" --thread=1 --direct=1 \ + --offset="${write_offset}" --size="${write_size}" \ + --name="$dev" --wait_for="write_job" "$@" --thread=1 --direct=1 +} + # Run fio on the first four sequential zones of the disk. run_fio_on_seq() { local opts=() -- 2.26.2