Currently, `scsi_debug` only supported a maximum `sector_size` of 4096 bytes. However, on systems with a `PAGE_SIZE` greater than 4KB, some `throtl` tests (002, 003, and 007) attempt to load `scsi_debug` with `sector_size=$PAGE_SIZE`. This mismatch causes `scsi_debug` module loading to fail, resulting in test failures such as: throtl/003 (sdebug) (bps limit over IO split) [failed] runtime 0.147s ... 0.146s --- tests/throtl/003.out 2025-04-04 04:36:43.175999880 +0800 +++ /root/blktests/results/nodev_sdebug/throtl/003.out.bad 2025-11-16 09:26:07.287964459 +0800 @@ -1,4 +1,3 @@ Running throtl/003 -1 -1 -Test complete +modprobe: ERROR: could not insert 'scsi_debug': Invalid argument +Loading scsi_debug dev_size_mb=1024 sector_size=65536 failed To address this, introduce a `fixup_sedebug_sector_size` helper function. This function checks the requested `sector_size` for `scsi_debug`. If the value exceeds 4096, it defaults to a supported value of 2048 to ensure successful module loading and test execution on hosts with larger `PAGE_SIZE`. Signed-off-by: Li Zhijian --- tests/throtl/rc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/throtl/rc b/tests/throtl/rc index d1afefd..fd83fb9 100644 --- a/tests/throtl/rc +++ b/tests/throtl/rc @@ -41,6 +41,17 @@ _set_throtl_blkdev_type() { COND_DESC="${throtl_blkdev_type}" } +# Only 512, 1024, 2048, 4096 are supported, see drivers/scsi/scsi_debug.c +fixup_sdebug_sector_size() { + local sector_size=$1 + + if [[ $sector_size -gt 4096 ]]; then + echo 2048 + else + echo $sector_size + fi +} + # Prepare null_blk or scsi_debug device to test, based on throtl_blkdev_type. _configure_throtl_blkdev() { local sector_size=0 memory_backed=0 @@ -76,7 +87,8 @@ _configure_throtl_blkdev() { ;; sdebug) args=(dev_size_mb=1024) - ((sector_size)) && args+=(sector_size="${sector_size}") + ((sector_size)) && + args+=(sector_size="$(fixup_sdebug_sector_size $sector_size)") if _configure_scsi_debug "${args[@]}"; then THROTL_DEV=${SCSI_DEBUG_DEVICES[0]} return -- 2.44.0