[PATCH] nvme-topology: have list-subsys print only controllers with attached namespace

Chaitanya Kulkarni Chaitanya.Kulkarni at wdc.com
Mon Mar 15 21:13:45 GMT 2021


On 3/15/21 14:01, Sagi Grimberg wrote:
> 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).
>
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>

This is much clear than what we have currently, looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>








More information about the Linux-nvme mailing list