All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH 7/7] ndctl: auto initialize labels
Date: Tue, 29 Aug 2017 16:43:04 -0600	[thread overview]
Message-ID: <20170829224304.GA16374@omniknight.lm.intel.com> (raw)
In-Reply-To: <1504043431.7034.3.camel@intel.com>

On 08/29, Verma, Vishal L wrote:
> On Tue, 2017-08-29 at 14:48 -0700, Dan Williams wrote:
> > On Tue, Aug 29, 2017 at 2:32 PM, Verma, Vishal L
> > <vishal.l.verma@intel.com> wrote:
> > > On Tue, 2017-08-29 at 13:02 -0700, Dan Williams wrote:
> > > > If we are reconfiguring an ND_DEVICE_NAMESPACE_IO namespace take
> > > > the
> > > > opportunity to potentially initialize labels. DIMM capacity that
> > > > is
> > > > not
> > > > aliased will surface as a label-less namespace by default. If
> > > > every
> > > > DIMM
> > > > in the interleave set supports labels we can switch a more dynamic
> > > > configuration, i.e. enable pmem sub-division.
> > > > 
> > > > The --no-autolabel option is added to disable this behavior if it
> > > > is
> > > > not
> > > > wanted.
> > > > 
> > > > Cc: Vishal Verma <vishal.l.verma@intel.com>
> > > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > > > ---
> > > >  Documentation/ndctl/ndctl-create-namespace.txt |    7 ++
> > > >  ndctl/namespace.c                              |   90
> > > > +++++++++++++++++++++++-
> > > >  2 files changed, 95 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/Documentation/ndctl/ndctl-create-namespace.txt
> > > > b/Documentation/ndctl/ndctl-create-namespace.txt
> > > > index 85d1f8db792f..3844ff74a9f1 100644
> > > > --- a/Documentation/ndctl/ndctl-create-namespace.txt
> > > > +++ b/Documentation/ndctl/ndctl-create-namespace.txt
> > > > @@ -138,6 +138,13 @@ OPTIONS
> > > >       active.  Specifying --force causes the namespace to be
> > > > disabled
> > > >       before reconfiguring.
> > > > 
> > > > +-L::
> > > > +--autolabel::
> > > 
> > > Shouldn't this be --no-autolabel
> > > 
> > > > +     When ndctl encounters a label-less namespace while
> > > > +     performing a reconfigure operation it will try to enable
> > > > labels
> > > > +     for the region. This behavior can be suppressed with
> > > > +     "--no-autolabel".
> > > 
> > > And the text description matched to describe only the --no-autolabel
> > > option instead of describing both a positive and negative
> > 
> > I'm using a side effect of the way ndctl (and git) implement
> > OPT_BOOLEAN() options. They all automatically get a --no-<option>. So
> > "--autolabel" is the default.
> > 
> Ah cool, I didn't know OPT_BOOLEAN does that for you.
> Does the 'no' option then lack a short option? We'll end up providing a
> short option for the default case, but nothing for the override..
> 
> I'm also wondering if there will be any bash completion implications.
> I'll test whether the --no- option shows up automatically in --list-opts

Patch to special case --no-autolabel for completion:

8<----

>From f18c54d3260c3310d14aaa9aa589de4abc304bf1 Mon Sep 17 00:00:00 2001
From: Vishal Verma <vishal.l.verma@intel.com>
Date: Tue, 29 Aug 2017 16:38:36 -0600
Subject: [PATCH] ndctl, bash-completion: special case --no-autolabel for
 create-namespace

OPT_BOOLEAN provides a --no-* option automatically for all boolean
options, but the negative versions aren't listed in --list-opts.

Special case --no-autolabel since that is the only one where the
negative makes sense.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 contrib/ndctl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/contrib/ndctl b/contrib/ndctl
index 9410572..c7e3e7d 100755
--- a/contrib/ndctl
+++ b/contrib/ndctl
@@ -261,6 +261,17 @@ __ndctl_comp_non_option_args()
 	__ndctlcomp "$opts" "$cur"
 }
 
+__ndctl_add_special_opts()
+{
+	local subcmd=$1
+
+	case $subcmd in
+	create-namespace)
+		opts="$opts --no-autolabel"
+		;;
+	esac
+}
+
 __ndctl_prev_skip_opts ()
 {
 	local i cmd_ cmds_
@@ -354,6 +365,7 @@ __ndctl_main()
 		# List long option names
 		if [[ $cur == --* ]];  then
 			opts=$($cmd $subcmd --list-opts)
+			__ndctl_add_special_opts "$subcmd"
 			__ndctlcomp "$opts" "$cur"
 			__ndctl_comp_options "$cur"
 		else
-- 
2.9.5



> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

      reply	other threads:[~2017-08-29 22:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 20:01 [ndctl PATCH 0/7] ndctl: automatically initialize labels Dan Williams
2017-08-29 20:01 ` [ndctl PATCH 1/7] ndctl, init-labels: fix '--label-version' option Dan Williams
2017-08-29 20:01 ` [ndctl PATCH 2/7] ndctl: drop the "libndctl-" prefix on library source files Dan Williams
2017-08-29 20:01 ` [ndctl PATCH 3/7] ndctl: move label manipulation routines to their own file Dan Williams
2017-08-29 20:01 ` [ndctl PATCH 4/7] ndctl: consolidate namespace definitions in namespace.h Dan Williams
2017-08-29 20:01 ` [ndctl PATCH 5/7] ndctl: refactor read_labels() helper into a library call Dan Williams
2017-08-29 20:02 ` [ndctl PATCH 6/7] ndctl: introduce ndctl_dimm_{validate_labels, init_labels} Dan Williams
2017-08-29 20:02 ` [ndctl PATCH 7/7] ndctl: auto initialize labels Dan Williams
2017-08-29 21:32   ` Verma, Vishal L
2017-08-29 21:48     ` Dan Williams
2017-08-29 21:52       ` Verma, Vishal L
2017-08-29 22:43         ` Vishal Verma [this message]

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=20170829224304.GA16374@omniknight.lm.intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /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 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.