From: Harish <harish@linux.ibm.com>
To: Santosh Sivaraj <santosh@fossix.org>,
linux-nvdimm@lists.01.org,
Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Subject: Re: [PATCH ndctl] namespace-action: Don't act on any seed namespaces
Date: Mon, 6 Jul 2020 14:59:43 +0530 [thread overview]
Message-ID: <b79f5d0d-d0ef-09a3-5f19-456512941e6c@linux.ibm.com> (raw)
In-Reply-To: <20200705041519.3263863-1-santosh@fossix.org>
Tested-by: Harish <harish@linux.ibm.com>
- Harish
On 7/5/20 9:45 AM, Santosh Sivaraj wrote:
> Catch seed namespaces early on. This will prevent checking for sizes in enable,
> disable and destroy namespace code path, which in turn prevents the inconsistent
> reporting in count of enabled/disabled namespaces.
>
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
> ---
> ndctl/lib/libndctl.c | 5 -----
> ndctl/namespace.c | 14 ++------------
> 2 files changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index ee737cb..d0599f7 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -4130,16 +4130,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
> const char *devname = ndctl_namespace_get_devname(ndns);
> struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
> struct ndctl_region *region = ndns->region;
> - unsigned long long size = ndctl_namespace_get_size(ndns);
> int rc;
>
> if (ndctl_namespace_is_enabled(ndns))
> return 0;
>
> - /* Don't try to enable idle namespace (no capacity allocated) */
> - if (size == 0)
> - return -ENXIO;
> -
> rc = ndctl_bind(ctx, ndns->module, devname);
>
> /*
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 0550580..5a086d0 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -1102,7 +1102,6 @@ static int namespace_destroy(struct ndctl_region *region,
> struct ndctl_namespace *ndns)
> {
> const char *devname = ndctl_namespace_get_devname(ndns);
> - unsigned long long size;
> bool did_zero = false;
> int rc;
>
> @@ -1147,19 +1146,9 @@ static int namespace_destroy(struct ndctl_region *region,
> goto out;
> }
>
> - size = ndctl_namespace_get_size(ndns);
> -
> rc = ndctl_namespace_delete(ndns);
> if (rc)
> debug("%s: failed to reclaim\n", devname);
> -
> - /*
> - * Don't report a destroyed namespace when no capacity was
> - * allocated.
> - */
> - if (size == 0 && rc == 0)
> - rc = 1;
> -
> out:
> return rc;
> }
> @@ -2128,8 +2117,9 @@ static int do_xaction_namespace(const char *namespace,
> ndctl_namespace_foreach_safe(region, ndns, _n) {
> ndns_name = ndctl_namespace_get_devname(ndns);
>
> - if (strcmp(namespace, "all") != 0
> + if ((strcmp(namespace, "all") != 0
> && strcmp(namespace, ndns_name) != 0)
> + || ndctl_namespace_get_size(ndns) == 0)
> continue;
> switch (action) {
> case ACTION_DISABLE:
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
prev parent reply other threads:[~2020-07-06 9:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-05 4:15 [PATCH ndctl] namespace-action: Don't act on any seed namespaces Santosh Sivaraj
2020-07-06 9:29 ` Harish [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=b79f5d0d-d0ef-09a3-5f19-456512941e6c@linux.ibm.com \
--to=harish@linux.ibm.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=linux-nvdimm@lists.01.org \
--cc=santosh@fossix.org \
--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