Currently, the test case throtl/002 assumes that the test target device is null_blk. For null_blk, it is possible to specify the page size as the maximum I/O size during set up. However, in the case of scsi_debug, the maximum I/O size is not configurable, causing the test case to fail when the test case is extended to support scsi_debug. To prevent the failure, set the maximum I/O size after the test device is initialized, regardless of the device type. To achieve this, add a new helper function _throtl_set_max_io_size() which modifies the sysfs attribute max_sectors_kb to adjust the maximum I/O size for the device. Suggested-by: Yu Kuai Signed-off-by: Shin'ichiro Kawasaki --- tests/throtl/002 | 5 ++++- tests/throtl/rc | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/throtl/002 b/tests/throtl/002 index bed876d..87b9f91 100755 --- a/tests/throtl/002 +++ b/tests/throtl/002 @@ -24,7 +24,10 @@ test() { fi io_size_kb=$(($(_throtl_get_max_io_size) * 1024)) - block_size=$((iops * io_size_kb)) + if [ "${io_size_kb}" -gt "${page_size}" ]; then + _throtl_set_max_io_size $((page_size / 1024)) + fi + block_size=$((iops * page_size)) _throtl_set_limits wiops="${iops}" _throtl_test_io write "${block_size}" 1 diff --git a/tests/throtl/rc b/tests/throtl/rc index d20dc94..8c25b1a 100644 --- a/tests/throtl/rc +++ b/tests/throtl/rc @@ -114,6 +114,10 @@ _throtl_get_max_io_size() { cat "/sys/block/$THROTL_DEV/queue/max_sectors_kb" } +_throtl_set_max_io_size() { + echo "$1" > "/sys/block/$THROTL_DEV/queue/max_sectors_kb" +} + _throtl_issue_fs_io() { local path=$1 local start_time -- 2.51.0