Linux-NVDIMM Archive on lore.kernel.org
 help / color / Atom feed
From: Santosh Sivaraj <santosh@fossix.org>
To: linux-nvdimm@lists.01.org,
	Vishal Verma <vishal.l.verma@intel.com>,
	vaibhav@linux.ibm.com
Cc: Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH ndctl] namespace/create: Don't create multiple namespace unless greedy
Date: Wed,  4 Dec 2019 15:25:53 +0530
Message-ID: <20191204095553.83209-1-santosh@fossix.org> (raw)

From: Vaibhav Jain <vaibhav@linux.ibm.com>

Currently create-namespace creates two namespaces with the '-f' option
even without the greedy flag. This behavior got introduced by
c75f7236d. The earlier behaviour was to create one namespace even with
the '-f' flag. The earlier behavior:

$ sudo ./ndctl/ndctl create-namespace -s 16M -f
[sudo] password for santosh:
{
  "dev":"namespace1.14",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"03f6b921-7684-4736-b2be-87f021996e52",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem1.14"
}

After greedy option was introduced:

$ sudo ./ndctl/ndctl create-namespace -s 16M -f
{
  "dev":"namespace1.8",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"1a9d6610-558b-454e-8b95-76c6201798cb",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem1.8"
}
{
  "dev":"namespace0.3",
  "mode":"fsdax",
  "map":"dev",
  "size":"14.00 MiB (14.68 MB)",
  "uuid":"eed9d28b-69a2-4c7c-9503-24e8aee87b1e",
  "sector_size":512,
  "align":65536,
  "blockdev":"pmem0.3"
}

If no region or '-c' flag is specified bail out if the creation was successful.

Fixes: c75f7236d (ndctl/namespace: add a --continue option to create namespaces greedily)
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
 ndctl/namespace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 7fb0007..8098456 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1392,6 +1392,8 @@ static int do_xaction_namespace(const char *namespace,
 				if (force) {
 					if (rc)
 						saved_rc = rc;
+					else if (!param.region)
+							return rc;
 					continue;
 				}
 				return rc;
-- 
2.23.0
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04  9:55 Santosh Sivaraj [this message]
2019-12-04 17:51 ` Dan Williams

Reply instructions:

You may reply publically 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=20191204095553.83209-1-santosh@fossix.org \
    --to=santosh@fossix.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vaibhav@linux.ibm.com \
    --cc=vishal.l.verma@intel.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

Linux-NVDIMM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvdimm/0 linux-nvdimm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvdimm linux-nvdimm/ https://lore.kernel.org/linux-nvdimm \
		linux-nvdimm@lists.01.org
	public-inbox-index linux-nvdimm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.01.lists.linux-nvdimm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git