Test the combination of bps and iops limits under io splitting scenarios. Regression test for commit d1ba22ab2bec ("blk-throttle: Prevents the bps restricted io from entering the bps queue again"). Signed-off-by: Zizhi Wo <wozizhi@xxxxxxxxxxxxxxx> --- tests/throtl/007 | 45 ++++++++++++++++++++++++++++++++++++++++++++ tests/throtl/007.out | 6 ++++++ 2 files changed, 51 insertions(+) create mode 100755 tests/throtl/007 create mode 100644 tests/throtl/007.out diff --git a/tests/throtl/007 b/tests/throtl/007 new file mode 100755 index 0000000..ae59c6f --- /dev/null +++ b/tests/throtl/007 @@ -0,0 +1,45 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Zizhi Wo +# +# Test the combination of bps and iops limits under io splitting scenarios. +# Regression test for commit d1ba22ab2bec ("blk-throttle: Prevents the bps +# restricted io from entering the bps queue again") + +. tests/throtl/rc + +DESCRIPTION="bps limit with iops limit over io split" +QUICK=1 + +test() { + echo "Running ${TEST_NAME}" + + local page_size max_secs + page_size=$(getconf PAGE_SIZE) + max_secs=$((page_size / 512)) + + if ! _set_up_throtl max_sectors="${max_secs}"; then + return 1; + fi + + local bps_limit=$((1024 * 1024)) + local iops_limit=1000000 + + # just set bps limit first + _throtl_set_limits wbps=$bps_limit + _throtl_test_io write 1M 1 & + _throtl_test_io write 1M 1 & + wait + _throtl_remove_limits + + # set the same bps limit and a high iops limit + # should behave the same as no iops limit + _throtl_set_limits wbps=$bps_limit wiops=$iops_limit + _throtl_test_io write 1M 1 & + _throtl_test_io write 1M 1 & + wait + _throtl_remove_limits + + _clean_up_throtl + echo "Test complete" +} diff --git a/tests/throtl/007.out b/tests/throtl/007.out new file mode 100644 index 0000000..d28cdef --- /dev/null +++ b/tests/throtl/007.out @@ -0,0 +1,6 @@ +Running throtl/007 +1 +2 +1 +2 +Test complete -- 2.39.2