linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / 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	[thread overview]
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	other threads:[~2019-12-04  9:56 UTC|newest]

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 ` [PATCH ndctl] namespace/create: Don't create multiple namespace unless greedy Dan Williams

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=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
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;
as well as URLs for NNTP newsgroup(s).