Skip to content

Commit c1a57de

Browse files
committed
throtl/rc,002: adjust to scsi_debug
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 <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent f2c1330 commit c1a57de

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

tests/throtl/002

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ test() {
2424
fi
2525

2626
io_size_kb=$(($(_throtl_get_max_io_size) * 1024))
27-
block_size=$((iops * io_size_kb))
27+
if [ "${io_size_kb}" -gt "${page_size}" ]; then
28+
_throtl_set_max_io_size $((page_size / 1024))
29+
fi
30+
block_size=$((iops * page_size))
2831

2932
_throtl_set_limits wiops="${iops}"
3033
_throtl_test_io write "${block_size}" 1

tests/throtl/rc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ _throtl_get_max_io_size() {
114114
cat "/sys/block/$THROTL_DEV/queue/max_sectors_kb"
115115
}
116116

117+
_throtl_set_max_io_size() {
118+
echo "$1" > "/sys/block/$THROTL_DEV/queue/max_sectors_kb"
119+
}
120+
117121
_throtl_issue_fs_io() {
118122
local path=$1
119123
local start_time

0 commit comments

Comments
 (0)