diff mbox series

[blktests,v3,03/13] block/004: Adjust fio conditions for zoned block devices

Message ID 20190118094453.13773-4-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Implement zoned block device support | expand

Commit Message

Shin'ichiro Kawasaki Jan. 18, 2019, 9:44 a.m. UTC
For a random write pattern to a zoned block device, fio requires --direct=1
and --zonemode=zbd options as well as deadline I/O scheduler to be
specified. Specify these options and set the I/O scheduler if the target
device is a zoned block device. Before doing that, also make sure that the
deadline scheduler is available and that fio supports the zbd zone mode.
Set CAN_BE_ZONED flag to run this test case for zoned block devices.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/block/004 | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Omar Sandoval Jan. 25, 2019, 9:09 p.m. UTC | #1
On Fri, Jan 18, 2019 at 06:44:43PM +0900, Shin'ichiro Kawasaki wrote:
> For a random write pattern to a zoned block device, fio requires --direct=1
> and --zonemode=zbd options as well as deadline I/O scheduler to be
> specified. Specify these options and set the I/O scheduler if the target
> device is a zoned block device. Before doing that, also make sure that the
> deadline scheduler is available and that fio supports the zbd zone mode.
> Set CAN_BE_ZONED flag to run this test case for zoned block devices.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  tests/block/004 | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/block/004 b/tests/block/004
> index 4c14c4b..7340d33 100755
> --- a/tests/block/004
> +++ b/tests/block/004
> @@ -8,6 +8,7 @@
>  
>  DESCRIPTION="run lots of flushes"
>  TIMED=1
> +CAN_BE_ZONED=1
>  
>  requires() {
>  	_have_fio
> @@ -16,10 +17,25 @@ requires() {
>  test_device() {
>  	echo "Running ${TEST_NAME}"
>  
> +	local directio=""
> +	local zbdmode=""
> +
> +	if _test_dev_is_zoned; then
> +		if ! _have_fio_zbd_zonemode; then
> +			echo "${SKIP_REASON}"
> +			return 1
> +		fi

This will be marked as a failure instead of skipped. This check can be
in device_requires instead:

device_requires() {
	! _test_dev_is_zoned || _have_fio_zbd_zonemode
}

> +		_test_dev_queue_set scheduler deadline
> +
> +		directio="--direct=1"
> +		zbdmode="--zonemode=zbd"
> +	fi
> +
>  	FIO_PERF_FIELDS=("write iops")
>  	_fio_perf --bs=4k --rw=randwrite --norandommap --fsync=1 \
>  		--number_ios=256 --numjobs=64 --name=flushes \
> -		--filename="$TEST_DEV"
> +		${directio} ${zbdmode} --filename="$TEST_DEV"

I'm surprised that shellcheck is smart enough to see that directio and
zbdmode are always one word so this doesn't need quotes :)

>  
>  	echo "Test complete"
>  }
> -- 
> 2.20.1
>
Shin'ichiro Kawasaki Jan. 28, 2019, 10:13 a.m. UTC | #2
On 1/26/19 6:09 AM, Omar Sandoval wrote:
> On Fri, Jan 18, 2019 at 06:44:43PM +0900, Shin'ichiro Kawasaki wrote:
>> @@ -16,10 +17,25 @@ requires() {
>>   test_device() {
>>   	echo "Running ${TEST_NAME}"
>>   
>> +	local directio=""
>> +	local zbdmode=""
>> +
>> +	if _test_dev_is_zoned; then
>> +		if ! _have_fio_zbd_zonemode; then
>> +			echo "${SKIP_REASON}"
>> +			return 1
>> +		fi
> 
> This will be marked as a failure instead of skipped. This check can be
> in device_requires instead:
> 
> device_requires() {
> 	! _test_dev_is_zoned || _have_fio_zbd_zonemode
> }

Thanks. Will change as suggested.

>> +		_test_dev_queue_set scheduler deadline
>> +
>> +		directio="--direct=1"
>> +		zbdmode="--zonemode=zbd"
>> +	fi
>> +
>>   	FIO_PERF_FIELDS=("write iops")
>>   	_fio_perf --bs=4k --rw=randwrite --norandommap --fsync=1 \
>>   		--number_ios=256 --numjobs=64 --name=flushes \
>> -		--filename="$TEST_DEV"
>> +		${directio} ${zbdmode} --filename="$TEST_DEV"
> 
> I'm surprised that shellcheck is smart enough to see that directio and
> zbdmode are always one word so this doesn't need quotes :)

Yes, and if I quote ${directio} and ${zbdmode}, fio fails with error message 
"unable to open '' job file". I leave them without quotes.
diff mbox series

Patch

diff --git a/tests/block/004 b/tests/block/004
index 4c14c4b..7340d33 100755
--- a/tests/block/004
+++ b/tests/block/004
@@ -8,6 +8,7 @@ 
 
 DESCRIPTION="run lots of flushes"
 TIMED=1
+CAN_BE_ZONED=1
 
 requires() {
 	_have_fio
@@ -16,10 +17,25 @@  requires() {
 test_device() {
 	echo "Running ${TEST_NAME}"
 
+	local directio=""
+	local zbdmode=""
+
+	if _test_dev_is_zoned; then
+		if ! _have_fio_zbd_zonemode; then
+			echo "${SKIP_REASON}"
+			return 1
+		fi
+
+		_test_dev_queue_set scheduler deadline
+
+		directio="--direct=1"
+		zbdmode="--zonemode=zbd"
+	fi
+
 	FIO_PERF_FIELDS=("write iops")
 	_fio_perf --bs=4k --rw=randwrite --norandommap --fsync=1 \
 		--number_ios=256 --numjobs=64 --name=flushes \
-		--filename="$TEST_DEV"
+		${directio} ${zbdmode} --filename="$TEST_DEV"
 
 	echo "Test complete"
 }