]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme-topology: have list-subsys print only controllers with attached namespace
authorSagi Grimberg <sagi@grimberg.me>
Mon, 15 Mar 2021 20:52:09 +0000 (13:52 -0700)
committerKeith Busch <kbusch@kernel.org>
Mon, 15 Mar 2021 21:39:56 +0000 (06:39 +0900)
commit47b7da8a75b6e43a1e1e9b471d7f6c25e8c50159
treea025065e211e873f42ac4b5f63360de5a5a6f405
parent42f7e6296924e703f2e294b073bc7de597e13477
nvme-topology: have list-subsys print only controllers with attached namespace

When running list-subsys on a specific namespace, we output all the
controllers that belong to the subsystem regardless if the requested
namespace is actually attached to them.

Example:
$ nvme list-subsys /dev/nvme0n1
nvme-subsys0 - NQN=nqn.2016-01.com.lightbitslabs:uuid:07cfffe6-5a4f-4151-b663-e13cf835609b
\
 +- nvme0 tcp traddr=10.113.5.1 trsvcid=4420 live optimized
 +- nvme1 tcp traddr=10.133.3.1 trsvcid=4420 live
 +- nvme2 tcp traddr=10.133.1.1 trsvcid=4420 live
 +- nvme3 tcp traddr=10.113.1.1 trsvcid=4420 live inaccessible
 +- nvme4 tcp traddr=10.133.5.1 trsvcid=4420 live
 +- nvme5 tcp traddr=10.113.4.1 trsvcid=4420 live
 +- nvme6 tcp traddr=10.133.4.1 trsvcid=4420 live
 +- nvme7 tcp traddr=10.113.2.1 trsvcid=4420 live
 +- nvme8 tcp traddr=10.133.2.1 trsvcid=4420 live
 +- nvme9 tcp traddr=10.113.3.1 trsvcid=4420 live

This output is somewhat confusing and makes the user think the namespace
is actually attached to all of these controllers, instead we want the
output which provided by the change introduced here:

$ nvme list-subsys /dev/nvme0n1
nvme-subsys0 - NQN=nqn.2016-01.com.lightbitslabs:uuid:07cfffe6-5a4f-4151-b663-e13cf835609b
\
 +- nvme0 tcp traddr=10.113.5.1 trsvcid=4420 live optimized
 +- nvme3 tcp traddr=10.113.1.1 trsvcid=4420 live inaccessible

Do the same trick as we do in scan_subsystems, we add the ctrl to the
topology if either ns_instance wasn't passed (see all controllers) or
it was pased _and_ the controller has this namespace is attached to
the controller (to do that we add nsid down the call chain for that).

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
fabrics.c
nvme-print.c
nvme-topology.c
nvme.c
nvme.h