blktests: test turning wbt on and off
PATCH 1/1 blktests: test turning wbt on and off
There have been a few issues with turning wbt on and off while IO is in flight, so add a test that just does some random rw IO and has a background thread that toggles wbt on and off.
--- tests/block/027 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ tests/block/027.out | 2 ++ 2 files changed, 49 insertions(+) create mode 100755 tests/block/027 create mode 100644 tests/block/027.out
tests/block/027 new file +47 -0
@@ -0,0 +1,47 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Josef Bacik +# +# Turn wbt on and off in the background while writing to the disk to verify +# there's no races in the inflight counter manipulation + +. tests/block/rc + +DESCRIPTION="run a read workload and write workload together with wbt" + +requires() { + _have_fio && _have_program jq +} + +device_requires() { + _test_dev_supports_wbt +} + +toggle_wbt() { + while true + do + _test_dev_queue_set wbt_lat_usec 0 + sleep 1 + _test_dev_queue_set wbt_lat_usec 1 + sleep 1 + done +} + +test_device() { + echo "Running ${TEST_NAME}" + + local wbt_setting toggle_pid + wbt_setting=$(_test_dev_queue_get wbt_lat_usec) + + (toggle_wbt &) + toggle_pid=$! + + _run_fio --name randrw --numjobs=8 --runtime=30 --randseed=12345 \ + --ioengine=psync --readwrite=randrw --filename="$TEST_DEV" + + kill $toggle_pid > /dev/null 2>&1 + wait + _test_dev_queue_set wbt_lat_usec "$wbt_setting" + + echo "Test complete" +}
tests/block/027.out new file +2 -0
@@ -0,0 +1,2 @@ +Running block/027 +Test complete
Signature · 1 line
2.14.3
Quoted 21 lines · Josef Bacik
There have been a few issues with turning wbt on and off while IO is in flight, so add a test that just does some random rw IO and has a background thread that toggles wbt on and off.
Signed-off-by Josef Bacik <[email protected]>--- tests/block/027 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ tests/block/027.out | 2 ++ 2 files changed, 49 insertions(+) create mode 100755 tests/block/027 create mode 100644 tests/block/027.outtests/block/027 new file +3
-0@@ -0,0 +1,47 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018 Josef Bacik
tests/block/027 line 13
Quoted 10 lines
tests/block/027 new file +10
-0+# +# Turn wbt on and off in the background while writing to the disk to verify +# there's no races in the inflight counter manipulation + +. tests/block/rc + +DESCRIPTION="run a read workload and write workload together with wbt" + +requires() { + _have_fio && _have_program jq
This test doesn't use jq.
tests/block/027 line 26
Quoted 13 lines
tests/block/027 new file +13
-0+} + +device_requires() { + _test_dev_supports_wbt +} + +toggle_wbt() { + while true + do + _test_dev_queue_set wbt_lat_usec 0 + sleep 1 + _test_dev_queue_set wbt_lat_usec 1 + sleep 1
Trailing whitespace. ^^^^^^^^^^^^^^^^^
tests/block/027 line 30
Quoted 4 lines
tests/block/027 new file +4
-0+ done +} + +test_device() {
Since this is entirely in the block layer, this test doesn't seem like it needs a real device. Can it use null_blk instead? See block/006 for an example.
tests/block/027 line 40
Quoted 10 lines
tests/block/027 new file +10
-0+ echo "Running ${TEST_NAME}" + + local wbt_setting toggle_pid + wbt_setting=$(_test_dev_queue_get wbt_lat_usec) + + (toggle_wbt &) + toggle_pid=$! + + _run_fio --name randrw --numjobs=8 --runtime=30 --randseed=12345 \ + --ioengine=psync --readwrite=randrw --filename="$TEST_DEV"
If you leave off --runtime=30 here, _run_fio will automatically use the configured TIMEOUT, and you can make this a TIMED test (i.e., set TIMED=1 after DESCRIPTION=).
Quoted 17 lines
tests/block/027 new file +6
-0+ kill $toggle_pid > /dev/null 2>&1 + wait + _test_dev_queue_set wbt_lat_usec "$wbt_setting" + + echo "Test complete" +}tests/block/027.out new file +2
-0@@ -0,0 +1,2 @@ +Running block/027 +Test completeSignature · 1 line
2.14.3