nvme-multipath: Add visibility for round-robin io-policy
authorNilay Shroff <nilay@linux.ibm.com>
Sun, 12 Jan 2025 12:41:44 +0000 (18:11 +0530)
committerKeith Busch <kbusch@kernel.org>
Thu, 20 Mar 2025 23:53:54 +0000 (16:53 -0700)
commit4dbd2b2ebe4cc5f101881e2c091a70ccd38db7ee
treebb3e59e629f16dbea82384b3c359c96e9850f95d
parent316dabe6089fe85f7434d32808289d1965c452cb
nvme-multipath: Add visibility for round-robin io-policy

This patch helps add nvme native multipath visibility for round-robin
io-policy. It creates a "multipath" sysfs directory under head gendisk
device node directory and then from "multipath" directory it adds a link
to each namespace path device the head node refers.

For instance, if we have a shared namespace accessible from two different
controllers/paths then we create a soft link to each path device from head
disk node as shown below:

$ ls -l /sys/block/nvme1n1/multipath/
nvme1c1n1 -> ../../../../../pci052e:78/052e:78:00.0/nvme/nvme1/nvme1c1n1
nvme1c3n1 -> ../../../../../pci058e:78/058e:78:00.0/nvme/nvme3/nvme1c3n1

In the above example, nvme1n1 is head gendisk node created for a shared
namespace and the namespace is accessible from nvme1c1n1 and nvme1c3n1
paths.

For round-robin I/O policy, we could easily infer from the above output
that I/O workload targeted to nvme1n1 would toggle across paths nvme1c1n1
and nvme1c3n1.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h
drivers/nvme/host/sysfs.c