diff mbox series

[blktests,2/6] common/scsi_debug: prepare scsi_debug in zoned mode

Message ID 20220330013215.463555-3-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series extend zoned mode coverage for scsi devices | expand

Commit Message

Shinichiro Kawasaki March 30, 2022, 1:32 a.m. UTC
To allow running tests using scsi_debug device with the zoned mode
disabled (current setup) as well as enabled, modify the _init_scsi_debug
helper function. When RUN_FOR_ZONED is set, specify zbc=host-managed
parameter to scsi_debug module so that the scsi_debug devices are
prepared in zoned mode.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/scsi_debug | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/common/scsi_debug b/common/scsi_debug
index b48cdc9..95da14e 100644
--- a/common/scsi_debug
+++ b/common/scsi_debug
@@ -9,7 +9,16 @@  _have_scsi_debug() {
 }
 
 _init_scsi_debug() {
-	if ! modprobe -r scsi_debug || ! modprobe scsi_debug "$@"; then
+	local -a args=("$@")
+
+	if (( RUN_FOR_ZONED )); then
+		if ! _have_module_param scsi_debug zbc; then
+			return
+		fi
+		args+=(zbc=host-managed zone_nr_conv=0)
+	fi
+
+	if ! modprobe -r scsi_debug || ! modprobe scsi_debug "${args[@]}"; then
 		return 1
 	fi