All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH v4 2/4] ndctl: convert namespace actions to use util_filter_walk()
Date: Fri, 27 Apr 2018 12:25:31 -0700	[thread overview]
Message-ID: <CAPcyv4g240gwbHX4-JJUNeuzVy0T4Dz5Ykh=SQf7JyAuWCf5qA@mail.gmail.com> (raw)
In-Reply-To: <152485312055.47995.12642343910789705739.stgit@djiang5-desk3.ch.intel.com>

On Fri, Apr 27, 2018 at 11:18 AM, Dave Jiang <dave.jiang@intel.com> wrote:
> util_filter_walk() does the looping through of busses and regions. Removing
> duplicate code in namespace ops and provide filter functions so we can
> utilize util_filter_walk() and share common code.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  ndctl/namespace.c |  164 ++++++++++++++++++++++++++++++-----------------------
>  test/btt-check.sh |    2 -
>  util/filter.c     |    5 +-
>  util/filter.h     |    8 +++
>  4 files changed, 105 insertions(+), 74 deletions(-)
>
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index e61f500c..404d6761 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -983,14 +983,92 @@ static int namespace_reconfig(struct ndctl_region *region,
>  int namespace_check(struct ndctl_namespace *ndns, bool verbose, bool force,
>                 bool repair, bool logfix);
>
> +static bool filter_bus(struct ndctl_bus *bus, struct util_filter_ctx *ctx)
> +{
> +       return true;
> +}
> +
> +static bool filter_region(struct ndctl_region *region,
> +               struct util_filter_ctx *ctx)
> +{
> +       struct nsaction_filter_arg *nfa = ctx->nsaction;
> +       int rc = 0;
> +       bool out = true;
> +
> +       if (nfa->action == ACTION_CREATE && !nfa->namespace) {
> +               if (nfa->rc == 1)
> +                       return false;
> +
> +               rc = namespace_create(region);
> +               if (rc != -EAGAIN) {
> +                       if (rc == 0)
> +                               rc = 1;
> +                       /* don't proceed in the filter loop */
> +                       out = false;
> +               }
> +               nfa->rc = rc;
> +       }
> +
> +       return out;
> +}
> +
> +static void filter_namespace(struct ndctl_namespace *ndns,
> +               struct util_filter_ctx *ctx)
> +{
> +       struct ndctl_region *region = ndctl_namespace_get_region(ndns);
> +       struct nsaction_filter_arg *nfa = ctx->nsaction;
> +       const char *ndns_name;
> +       int rc;
> +
> +       /* we have an error, don't do anything else */
> +       if (nfa->rc < 0)
> +               return;

Why do we need to stop here? This seems like a behavior regression.

For example:

    ndctl disable-namespace all

Should continue to disable subsequent namespaces even if a previous
namespace attempt fails.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2018-04-27 19:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 18:18 [PATCH v4 0/4] ndctl: convert actions to use util_filter_walk Dave Jiang
2018-04-27 18:18 ` [PATCH v4 1/4] ndctl: convert namespace actions to use util_filter_params Dave Jiang
2018-04-27 18:18 ` [PATCH v4 2/4] ndctl: convert namespace actions to use util_filter_walk() Dave Jiang
2018-04-27 19:25   ` Dan Williams [this message]
2018-04-27 19:50     ` Dave Jiang
2018-04-27 18:18 ` [PATCH v4 3/4] ndctl: convert region " Dave Jiang
2018-04-27 18:18 ` [PATCH v4 4/4] ndctl: convert dimm " Dave Jiang

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='CAPcyv4g240gwbHX4-JJUNeuzVy0T4Dz5Ykh=SQf7JyAuWCf5qA@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=dave.jiang@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.