[PATCH blktests 6/8] nvme/031: open-code helper functions

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Thu Nov 7 03:13:52 PST 2024


From: Hannes Reinecke <hare at suse.de>

The default helper functions are doing quite some things which are unneccesary for
this test, so open-code them to call just the required functions.

Signed-off-by: Hannes Reinecke <hare at suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
 tests/nvme/031 | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/nvme/031 b/tests/nvme/031
index cd69e8e..3333338 100755
--- a/tests/nvme/031
+++ b/tests/nvme/031
@@ -44,14 +44,18 @@ test() {
 	port="$(_create_nvmet_port)"
 
 	for ((i = 0; i < iterations; i++)); do
-		_nvmet_target_setup --subsysnqn "${subsys}$i" \
+		subsysnqn=$(printf "blktests-subsystem-%d" "$i")
+		_create_nvmet_subsystem --subsysnqn "${subsysnqn}" \
 			--blkdev "${loop_dev}"
+		_add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
+		_create_nvmet_host "${subsysnqn}" "${def_hostnqn}"
 
-		_nvme_connect_subsys --subsysnqn "${subsys}$i"
-		_nvme_disconnect_subsys --subsysnqn "${subsys}$i" >> "${FULL}" 2>&1
+		_nvme_connect_subsys --subsysnqn "${subsysnqn}"
+		_nvme_disconnect_subsys --subsysnqn "${subsysnqn}" >> "${FULL}" 2>&1
 
-		_nvmet_target_cleanup --subsysnqn "${subsys}$i" \
-			--blkdev "${loop_dev}"
+		_remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}"
+		_remove_nvmet_subsystem "${subsysnqn}"
+		_remove_nvmet_host "${def_hostnqn}"
 	done
 
 	_remove_nvmet_port "${port}"
-- 
2.47.0




More information about the Linux-nvme mailing list