nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Qi, Fuli" <qi.fuli@jp.fujitsu.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: [RFC PATCH v4] ndctl: monitor: add ndctl monitor daemon
Date: Mon, 19 Mar 2018 20:27:26 +0900	[thread overview]
Message-ID: <f46164e9-676f-bd69-0e44-03139d275bfe@jp.fujitsu.com> (raw)
In-Reply-To: <CAPcyv4jPghKyQ6AuVJ-R=fiKcQufzHs-DExzcyHTbshF-2bq1Q@mail.gmail.com>


>> diff --git a/ndctl/ndctl-monitor.service b/ndctl/ndctl-monitor.service
>> new file mode 100644
>> index 0000000..2f1417b
>> --- /dev/null
>> +++ b/ndctl/ndctl-monitor.service
>> @@ -0,0 +1,7 @@
>> +[Unit]
>> +Description=Ndctl Monitor Daemon
>> +
>> +[Service]
>> +Type=forking
>> +ExecStart=/usr/bin/ndctl monitor -f
>> +ExecStop=/usr/bin/kill ${MAINPID}
>> diff --git a/ndctl/ndctl-monitor@.service b/ndctl/ndctl-monitor@.service
>> new file mode 100644
>> index 0000000..91c85d9
>> --- /dev/null
>> +++ b/ndctl/ndctl-monitor@.service
>> @@ -0,0 +1,9 @@
>> +[Unit]
>> +Description=Ndctl Monitor Daemon
>> +
>> +[Service]
>> +Type=forking
>> +EnvironmentFile=/etc/sysconfig/ndctl/%i
>> +ExecStart=/usr/bin/ndctl monitor $OPTIONS
>> +ExecStop=/usr/bin/kill ${MAINPID}
>> +ExecStopPost=/usr/bin/rm /etc/sysconfig/ndctl/%i
>> diff --git a/ndctl/ndctl.c b/ndctl/ndctl.c
>> index d3c6db1..8938621 100644
>> --- a/ndctl/ndctl.c
>> +++ b/ndctl/ndctl.c
>> @@ -86,6 +86,7 @@ static struct cmd_struct commands[] = {
>>          { "inject-error", cmd_inject_error },
>>          { "update-firmware", cmd_update_firmware },
>>          { "inject-smart", cmd_inject_smart },
>> +       { "monitor", cmd_monitor },
>>          { "list", cmd_list },
>>          { "help", cmd_help },
>>          #ifdef ENABLE_TEST
>> diff --git a/util/filter.c b/util/filter.c
>> index b0b7fdf..fba2197 100644
>> --- a/util/filter.c
>> +++ b/util/filter.c
>> @@ -315,7 +315,7 @@ int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
>>                                  || !util_bus_filter_by_namespace(bus, param->namespace))
>>                          continue;
>>
>> -               if (!fctx->filter_bus(bus, fctx))
>> +               if (fctx->filter_bus && !fctx->filter_bus(bus, fctx))
>>                          continue;
>>
>>                  ndctl_dimm_foreach(bus, dimm) {
>> @@ -345,7 +345,8 @@ int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
>>                          if (type && ndctl_region_get_type(region) != type)
>>                                  continue;
>>
>> -                       if (!fctx->filter_region(region, fctx))
>> +                       if (fctx->filter_region &&
>> +                                       !fctx->filter_region(region, fctx))
> No, I don't agree with these change. The filter_bus() and
> filter_region() callbacks are mandatory because, like list, you need
> to be prepared to handle dimms underneath the bus, and namespaces
> underneath a region.

The filter_bus() and filter_region() callbacks are mandatory in ndctl list,
but not in ndctl monitor.
Current design only monitors the events coming from DIMMs, does not monitor
events coming from buses yet. When monitoring the events coming from DIMMs,
we just need to put the DIMMs which match filters into a linklist using
filter_dimm(). No additional actions will be taken on buses. It is the 
similar
case as in ndctl list, when the command does not contain [--buses] option,
filter_bus() will always return true.


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

  parent reply	other threads:[~2018-03-19 11:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 11:33 [RFC PATCH v4] ndctl: monitor: add ndctl monitor daemon QI Fuli
2018-03-14 18:19 ` Dan Williams
2018-03-15 10:41   ` Qi, Fuli
2018-03-16  1:03     ` Dan Williams
2018-03-16  7:33       ` Yasunori Goto
2018-03-16 10:01         ` Qi, Fuli
2018-03-16  6:55   ` Yasunori Goto
2018-03-16 13:28     ` Dan Williams
2018-03-17  0:23       ` Yasunori Goto
2018-03-19 11:27   ` Qi, Fuli [this message]
2018-03-19 14:27     ` Dan Williams
2018-03-20  1:03       ` Qi, Fuli
2018-03-29 10:02   ` Qi, Fuli
2018-03-29 22:59     ` Dan Williams
2018-03-30  7:34       ` Qi, Fuli
2018-03-30 16:34         ` Dan Williams
2018-04-02  0:10           ` Qi, Fuli
2018-04-05 23:17       ` Qi, Fuli
2018-04-06 19:02         ` Dan Williams
2018-04-09  8:38           ` Qi, Fuli
2018-04-09 17:45             ` Dan Williams
2018-04-10  2:15               ` Qi, Fuli
2018-04-10  3:06               ` Verma, Vishal L
2018-04-04 14:28     ` Jeff Moyer
2018-04-05 21:08       ` Qi, Fuli

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=f46164e9-676f-bd69-0e44-03139d275bfe@jp.fujitsu.com \
    --to=qi.fuli@jp.fujitsu.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 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).