* [PATCH blktests v3] nvme/{common/nvme, 016, 017, 051, 052}: introduce def_nsid
@ 2024-10-31 10:14 Guixin Liu
2024-11-05 10:30 ` Shinichiro Kawasaki
0 siblings, 1 reply; 3+ messages in thread
From: Guixin Liu @ 2024-10-31 10:14 UTC (permalink / raw)
To: shinichiro.kawasaki, dwagner, chaitanyak; +Cc: linux-nvme
Use def_nsid instead of hard code, the default of def_nsid is 1.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
---
Changes from v2 to v3:
- Fix 016, 017, 052 do nothing when the def_nsid is set to
biger than iterations.(Shinichiro Kawasaki)
- Fix "make check" error in 052.(Shinichiro Kawasaki)
Changes from v1 to v2:
- change the hard code in _remove_nvmet_subsystem() to fix
the nvme/004 fail if change def_nsid to 2.(Shinichiro Kawasaki)
- Add RB tags from Chaitanya Kulkarni and Daniel Wagner (thanks!)
common/nvme | 5 +++--
tests/nvme/016 | 10 ++++++----
tests/nvme/017 | 10 ++++++----
tests/nvme/051 | 2 +-
tests/nvme/052 | 21 +++++++++++----------
5 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/common/nvme b/common/nvme
index c1aa8d6..99c2911 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}
@@ -588,7 +589,7 @@ _remove_nvmet_subsystem() {
local nvmet_subsystem="$1"
local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
- _remove_nvmet_ns "${nvmet_subsystem}" "1"
+ _remove_nvmet_ns "${nvmet_subsystem}" "${def_nsid}"
rm -f "${subsys_path}"/allowed_hosts/*
rmdir "${subsys_path}"
}
diff --git a/tests/nvme/016 b/tests/nvme/016
index 1143cab..b655d1d 100755
--- a/tests/nvme/016
+++ b/tests/nvme/016
@@ -32,9 +32,10 @@ test() {
_create_nvmet_subsystem --subsysnqn "${def_subsysnqn}" \
--blkdev "${loop_dev}"
- for ((i = 2; i <= iterations; i++)); do
+ for ((i = 1; i <= iterations; i++)); do
+ nsid=$((def_nsid + i))
_create_nvmet_ns --subsysnqn "${def_subsysnqn}" \
- --nsid "${i}" \
+ --nsid "${nsid}" \
--blkdev "${loop_dev}"
done
@@ -46,8 +47,9 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_port "${port}"
- for ((i = iterations; i > 1; i--)); do
- _remove_nvmet_ns "${def_subsysnqn}" "$i"
+ for ((i = iterations; i >= 1; i--)); do
+ nsid=$((def_nsid + i))
+ _remove_nvmet_ns "${def_subsysnqn}" "${nsid}"
done
_remove_nvmet_subsystem "${def_subsysnqn}"
diff --git a/tests/nvme/017 b/tests/nvme/017
index 5721000..ae335d0 100755
--- a/tests/nvme/017
+++ b/tests/nvme/017
@@ -33,9 +33,10 @@ test() {
--blkdev "$(_nvme_def_file_path)" \
--uuid "${def_subsys_uuid}"
- for ((i = 2; i <= iterations; i++)); do
+ for ((i = 1; i <= iterations; i++)); do
+ nsid=$((def_nsid + i))
_create_nvmet_ns --subsysnqn "${def_subsysnqn}" \
- --nsid "${i}" \
+ --nsid "${nsid}" \
--blkdev "$(_nvme_def_file_path)"
done
@@ -47,8 +48,9 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_port "${port}"
- for ((i = iterations; i > 1; i--)); do
- _remove_nvmet_ns "${def_subsysnqn}" "$i"
+ for ((i = iterations; i >= 1; i--)); do
+ nsid=$((def_nsid + i))
+ _remove_nvmet_ns "${def_subsysnqn}" "${nsid}"
done
_remove_nvmet_subsystem "${def_subsysnqn}"
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..574903a 100755
--- a/tests/nvme/052
+++ b/tests/nvme/052
@@ -57,35 +57,36 @@ 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 {
- truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path).$i"
+ for ((i = 1; i <= iterations; i++)); do {
+ nsid=$((def_nsid + i))
+ truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path).${nsid}"
uuid="$(uuidgen -r)"
_create_nvmet_ns --subsysnqn "${def_subsysnqn}" \
- --nsid "${i}" \
- --blkdev "$(_nvme_def_file_path).$i" \
+ --nsid "${nsid}" \
+ --blkdev "$(_nvme_def_file_path).${nsid}" \
--uuid "${uuid}"
# wait until async request is processed and ns is created
if ! nvmf_wait_for_ns "${uuid}" created; then
echo "FAIL"
- rm "$(_nvme_def_file_path).$i"
+ rm "$(_nvme_def_file_path).${nsid}"
break
fi
- _remove_nvmet_ns "${def_subsysnqn}" "${i}"
+ _remove_nvmet_ns "${def_subsysnqn}" "${nsid}"
# wait until async request is processed and ns is removed
if ! nvmf_wait_for_ns "${uuid}" removed; then
echo "FAIL"
- rm "$(_nvme_def_file_path).$i"
+ rm "$(_nvme_def_file_path).${nsid}"
break
fi
- rm "$(_nvme_def_file_path).$i"
+ rm "$(_nvme_def_file_path).${nsid}"
}
done
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH blktests v3] nvme/{common/nvme, 016, 017, 051, 052}: introduce def_nsid
2024-10-31 10:14 [PATCH blktests v3] nvme/{common/nvme, 016, 017, 051, 052}: introduce def_nsid Guixin Liu
@ 2024-11-05 10:30 ` Shinichiro Kawasaki
2024-11-06 1:42 ` Guixin Liu
0 siblings, 1 reply; 3+ messages in thread
From: Shinichiro Kawasaki @ 2024-11-05 10:30 UTC (permalink / raw)
To: Guixin Liu
Cc: dwagner@suse.de, chaitanyak@nvidia.com,
linux-nvme@lists.infradead.org
On Oct 31, 2024 / 18:14, Guixin Liu wrote:
> Use def_nsid instead of hard code, the default of def_nsid is 1.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> Reviewed-by: Daniel Wagner <dwagner@suse.de>
> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> Changes from v2 to v3:
> - Fix 016, 017, 052 do nothing when the def_nsid is set to
> biger than iterations.(Shinichiro Kawasaki)
> - Fix "make check" error in 052.(Shinichiro Kawasaki)
Guixin, thank you for this v3. I've applied the patch.
Unfortunately, this patch caused some conflicts with the series "nvme: prepare
for ANA support", so I took the liberty to modify this change. Please take a
look in the commit after the modification [1]. If there is any mistakes, please
let me know.
[1] https://github.com/osandov/blktests/commit/87d4c0cb93f32b7d0798b9faaed6bb2b39d636a2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH blktests v3] nvme/{common/nvme, 016, 017, 051, 052}: introduce def_nsid
2024-11-05 10:30 ` Shinichiro Kawasaki
@ 2024-11-06 1:42 ` Guixin Liu
0 siblings, 0 replies; 3+ messages in thread
From: Guixin Liu @ 2024-11-06 1:42 UTC (permalink / raw)
To: Shinichiro Kawasaki
Cc: dwagner@suse.de, chaitanyak@nvidia.com,
linux-nvme@lists.infradead.org
在 2024/11/5 18:30, Shinichiro Kawasaki 写道:
> On Oct 31, 2024 / 18:14, Guixin Liu wrote:
>> Use def_nsid instead of hard code, the default of def_nsid is 1.
>>
>> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
>> Reviewed-by: Daniel Wagner <dwagner@suse.de>
>> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
>> ---
>> Changes from v2 to v3:
>> - Fix 016, 017, 052 do nothing when the def_nsid is set to
>> biger than iterations.(Shinichiro Kawasaki)
>> - Fix "make check" error in 052.(Shinichiro Kawasaki)
> Guixin, thank you for this v3. I've applied the patch.
>
> Unfortunately, this patch caused some conflicts with the series "nvme: prepare
> for ANA support", so I took the liberty to modify this change. Please take a
> look in the commit after the modification [1]. If there is any mistakes, please
> let me know.
>
> [1] https://github.com/osandov/blktests/commit/87d4c0cb93f32b7d0798b9faaed6bb2b39d636a2
Looks like I'm missing to add "local nsid", thanks for modifing this.
Best Regards,
Guixin Liu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-06 1:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 10:14 [PATCH blktests v3] nvme/{common/nvme, 016, 017, 051, 052}: introduce def_nsid Guixin Liu
2024-11-05 10:30 ` Shinichiro Kawasaki
2024-11-06 1:42 ` Guixin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox