From: Ankit Kumar Date: Tue, 31 May 2022 13:31:53 +0000 (+0530) Subject: zbd: Check for direct flag only if its block device X-Git-Tag: test-tag-2022-08-09~40 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=59c3200d579004d1d9c2dd3a36c162c780d520e4;p=fio.git zbd: Check for direct flag only if its block device nvme-ns generic character devices currently do not support O_DIRECT flag. Check for fio option for direct flag only if filetype is a block device. t/zbd skip test case #1 for character devices as they don't require direct I/O. Tested-by: Vincent Fu Signed-off-by: Ankit Kumar Reviewed-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20220531133155.17493-8-ankit.kumar@samsung.com Signed-off-by: Jens Axboe --- diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support index 7e2fff00..5190ae84 100755 --- a/t/zbd/test-zbd-support +++ b/t/zbd/test-zbd-support @@ -229,6 +229,14 @@ require_regular_block_dev() { return 0 } +require_block_dev() { + if [[ -b "$realdev" ]]; then + return 0 + fi + SKIP_REASON="$dev is not a block device" + return 1 +} + require_seq_zones() { local req_seq_zones=${1} local seq_bytes=$((disk_size - first_sequential_zone_sector * 512)) @@ -251,8 +259,9 @@ require_conv_zones() { return 0 } -# Check whether buffered writes are refused. +# Check whether buffered writes are refused for block devices. test1() { + require_block_dev || return $SKIP_TESTCASE run_fio --name=job1 --filename="$dev" --rw=write --direct=0 --bs=4K \ "$(ioengine "psync")" --size="${zone_size}" --thread=1 \ --zonemode=zbd --zonesize="${zone_size}" 2>&1 | diff --git a/zbd.c b/zbd.c index b1fd6b4b..627fb968 100644 --- a/zbd.c +++ b/zbd.c @@ -466,7 +466,7 @@ out: return res; } -/* Verify whether direct I/O is used for all host-managed zoned drives. */ +/* Verify whether direct I/O is used for all host-managed zoned block drives. */ static bool zbd_using_direct_io(void) { struct thread_data *td; @@ -477,7 +477,7 @@ static bool zbd_using_direct_io(void) if (td->o.odirect || !(td->o.td_ddir & TD_DDIR_WRITE)) continue; for_each_file(td, f, j) { - if (f->zbd_info && + if (f->zbd_info && f->filetype == FIO_TYPE_BLOCK && f->zbd_info->model == ZBD_HOST_MANAGED) return false; }