Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: shinichiro.kawasaki@wdc.com, dwagner@suse.de, chaitanyak@nvidia.com
Cc: linux-nvme@lists.infradead.org
Subject: [PATCH] nvme/{common/nvme, 051, 052}: introduce def_nsid
Date: Tue, 29 Oct 2024 11:19:31 +0800	[thread overview]
Message-ID: <20241029031931.118305-1-kanie@linux.alibaba.com> (raw)

Use def_nsid instead of hard code, the default of def_nsid is 1.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 common/nvme    | 3 ++-
 tests/nvme/051 | 2 +-
 tests/nvme/052 | 6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/common/nvme b/common/nvme
index c1aa8d6..6371efe 100644
--- a/common/nvme
+++ b/common/nvme
@@ -16,6 +16,7 @@ def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349"
 def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}"
 export def_subsysnqn="blktests-subsystem-1"
 export def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+export def_nsid="1"
 _check_conflict_and_set_default NVMET_TRTYPES nvme_trtype "loop"
 _check_conflict_and_set_default NVME_IMG_SIZE nvme_img_size 1G
 _check_conflict_and_set_default NVME_NUM_ITER nvme_num_iter 1000
@@ -537,7 +538,7 @@ _create_nvmet_subsystem() {
 	mkdir -p "${cfs_path}"
 	echo 0 > "${cfs_path}/attr_allow_any_host"
 	_create_nvmet_ns --subsysnqn "${nvmet_subsystem}" \
-			 --nsid "1" \
+			 --nsid "${def_nsid}" \
 			 --blkdev "${blkdev}" \
 			 --uuid "${uuid}" \
 			 ${resv_enable}
diff --git a/tests/nvme/051 b/tests/nvme/051
index 624b42f..4757b80 100755
--- a/tests/nvme/051
+++ b/tests/nvme/051
@@ -33,7 +33,7 @@ test() {
 	_setup_nvmet
 
 	_nvmet_target_setup
-	ns="${NVMET_CFS}subsystems/${def_subsysnqn}/namespaces/1"
+	ns="${NVMET_CFS}subsystems/${def_subsysnqn}/namespaces/${def_nsid}"
 
 	# fire off two enable/disable loops concurrently and wait
 	# for them to complete...
diff --git a/tests/nvme/052 b/tests/nvme/052
index 1dcda23..781a9f0 100755
--- a/tests/nvme/052
+++ b/tests/nvme/052
@@ -57,10 +57,10 @@ test() {
 
 	_nvme_connect_subsys
 
-	# start iteration from ns-id 2 because ns-id 1 is created
-	# by default when nvme target is setup. Also ns-id 1 is
+	# start iteration from def_nsid+1 because def_nsid is created
+	# by default when nvme target is setup. Also def_nsid is
 	# deleted when nvme target is cleaned up.
-	for ((i = 2; i <= iterations; i++)); do {
+	for ((i = $((${def_nsid})) + 1; i <= iterations; i++)); do {
 		truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path).$i"
 		uuid="$(uuidgen -r)"
 
-- 
2.43.0



             reply	other threads:[~2024-10-29  3:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29  3:19 Guixin Liu [this message]
2024-10-29  5:03 ` [PATCH] nvme/{common/nvme, 051, 052}: introduce def_nsid Chaitanya Kulkarni
2024-10-29  8:48 ` Daniel Wagner
2024-10-30  7:31 ` Shinichiro Kawasaki
2024-10-30  7:38   ` Chaitanya Kulkarni
2024-10-30  9:44   ` Guixin Liu
2024-10-30 12:24     ` Shinichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241029031931.118305-1-kanie@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=chaitanyak@nvidia.com \
    --cc=dwagner@suse.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox