All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blktests: nvme add ns add and remove routines
@ 2018-05-24  3:43 Chaitanya Kulkarni
  2018-05-24  7:19 ` Johannes Thumshirn
  0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2018-05-24  3:43 UTC (permalink / raw)


This patch adds ns creation/deletion routines which can which can be
used to create and delete namespaces independently. Also, this avoids
hardcoding the namespace id when creating ns.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 common/nvme | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/common/nvme b/common/nvme
index 5d7d89c..d44b280 100644
--- a/common/nvme
+++ b/common/nvme
@@ -48,6 +48,15 @@ _remove_nvmet_port() {
 	rmdir "${NVMET_CFS}/ports/${port}"
 }
 
+_create_nvmet_ns() {
+	local nvmet_ns_path="$1"
+
+	mkdir "${nvmet_ns_path}"
+	printf "%s" "$blkdev" > "${nvmet_ns_path}/device_path"
+	printf "%s" "$uuid" > "${nvmet_ns_path}/device_uuid"
+	printf 1 > "${nvmet_ns_path}/enable"
+}
+
 _create_nvmet_subsystem() {
 	local nvmet_subsystem="$1"
 	local blkdev="$2"
@@ -60,18 +69,21 @@ _create_nvmet_subsystem() {
 
 	mkdir -p "${cfs_path}"
 	echo 1 > "${cfs_path}/attr_allow_any_host"
-	mkdir "${cfs_path}/namespaces/1"
-	printf "%s" "$blkdev" > "${cfs_path}/namespaces/1/device_path"
-	printf "%s" "$uuid" > "${cfs_path}/namespaces/1/device_uuid"
-	printf 1 > "${cfs_path}/namespaces/1/enable"
+	_create_nvmet_ns "${cfs_path}/namespaces/1/"
+}
+
+_remove_nvmet_ns() {
+	local nvmet_ns_path="$1"
+
+	echo 0 > "${nvmet_ns_path}/enable"
+	rmdir "${nvmet_ns_path}/"
 }
 
 _remove_nvmet_subsystem() {
 	local nvmet_subsystem="$1"
 	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
 
-	echo 0 > "${cfs_path}/namespaces/1/enable"
-	rmdir "${cfs_path}/namespaces/1/"
+	_remove_nvmet_ns "${cfs_path}/namespaces/1/"
 	rmdir "${cfs_path}"
 }
 
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] blktests: nvme add ns add and remove routines
  2018-05-24  3:43 [PATCH] blktests: nvme add ns add and remove routines Chaitanya Kulkarni
@ 2018-05-24  7:19 ` Johannes Thumshirn
  2018-06-04  3:58   ` chaitany kulkarni
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2018-05-24  7:19 UTC (permalink / raw)


Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] blktests: nvme add ns add and remove routines
  2018-05-24  7:19 ` Johannes Thumshirn
@ 2018-06-04  3:58   ` chaitany kulkarni
  0 siblings, 0 replies; 3+ messages in thread
From: chaitany kulkarni @ 2018-06-04  3:58 UTC (permalink / raw)


Please drop this, I've made some more modifications along with new
test cases, I'll send everything in a new series.

On Thu, May 24, 2018@12:19 AM, Johannes Thumshirn <jthumshirn@suse.de> wrote:
> Looks good,
> Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
> --
> Johannes Thumshirn                                          Storage
> jthumshirn at suse.de                                +49 911 74053 689
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
> GF: Felix Imend?rffer, Jane Smithard, Graham Norton
> HRB 21284 (AG N?rnberg)
> Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-04  3:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24  3:43 [PATCH] blktests: nvme add ns add and remove routines Chaitanya Kulkarni
2018-05-24  7:19 ` Johannes Thumshirn
2018-06-04  3:58   ` chaitany kulkarni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.