diff mbox

[v2,3/3] ndctl: add filtering based on numa_node

Message ID 20180308235720.GA14624@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Zwisler March 8, 2018, 11:57 p.m. UTC
On Thu, Mar 08, 2018 at 02:08:09PM -0700, Vishal Verma wrote:
> On 03/07, Ross Zwisler wrote:
> > Add support to 'ndctl list' so that we can filter DIMMs, regions and
> > namespaces based on numa node.
> > 
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > ---
> > v2: Use NUMA_NO_NODE intead of hard coding -1 (Dan).
> > ---
> >  Documentation/ndctl/ndctl-list.txt |  4 ++++
> >  ndctl/list.c                       |  2 ++
> >  util/filter.c                      | 40 ++++++++++++++++++++++++++++++++++++--
> >  util/filter.h                      |  1 +
> >  4 files changed, 45 insertions(+), 2 deletions(-)
> > 
> 
> Here is the bash completion update for this option.
> I've tested it on my single-node VM, but Ross, can you test it on your
> setup and let me know if it completes for the available nodes fine?
> 
> Thanks,
> 	-Vishal
> 
> 8<-----
> 
> From c744e77f26a27e10cc9dd8ca9b1092a45d9d9dcd Mon Sep 17 00:00:00 2001
> From: Vishal Verma <vishal.l.verma@intel.com>
> Date: Thu, 8 Mar 2018 13:56:59 -0700
> Subject: [ndctl PATCH] ndctl, bash-completion: add completion for --numa-node
> 
> ndctl list can now accept a --numa-node option for filtering by numa
> node. Use the nodes in /sys/devices/system/node to provide completion
> options for available nodes.
> 
> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

Yep, this works like a charm.  You can add:

Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>

For v3 of my patch which changed numa_node to numa-node I had to make the
following changes to your patch (just s/numa_node/numa-node/ in 2 places):
diff mbox

Patch

diff --git a/contrib/ndctl b/contrib/ndctl
index b1f5e59..a3a8675 100755
--- a/contrib/ndctl
+++ b/contrib/ndctl
@@ -91,7 +91,7 @@  __ndctlcomp()
 
        COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
        for cword in "${COMPREPLY[@]}"; do
-               if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace|--input|--output|--label-version|--align|--block|--count|--firmware|--media-temperature|--ctrl-temperature|--spares|--media-temperature-threshold|--ctrl-temperature-threshold|--spares-threshold|--media-temperature-alarm|--ctrl-temperature-alarm|--spares-alarm|--numa_node) ]]; then
+               if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace|--input|--output|--label-version|--align|--block|--count|--firmware|--media-temperature|--ctrl-temperature|--spares|--media-temperature-threshold|--ctrl-temperature-threshold|--spares-threshold|--media-temperature-alarm|--ctrl-temperature-alarm|--spares-alarm|--numa-node) ]]; then
                        COMPREPLY[$i]="${cword}="
                else
                        COMPREPLY[$i]="${cword} "
@@ -232,7 +232,7 @@  __ndctl_comp_options()
                --spares-alarm)
                        opts="on off"
                        ;;
-               --numa_node)
+               --numa-node)
                        opts=$(__ndctl_get_nodes)
                        ;;
                *)