[PATCH 00/19] nvme: switch to libmultipath

John Garry
2026-02-25T15:40:37Z

This switches the NVMe host driver to use libmultipath. That library
is very heavily based on the NVMe multipath code, so the change over
should hopefully be straightforward. There is often a direct replacement
for functions.

The multipath functionality in nvme_ns_head and nvme_ns structures are
replaced with the mpath_head, mpath_disk, and mpath_device structures.

In the driver we have places which test is the nvme_ns_head structure has
member nvme_ns' - for this the nvme_ns_head list was used. Since that
member will disappear, a count of nvme_ns' is added.

It's hard to switch to libmulipath in a step-by-step fashion without
breaking builds or functionality. To make the series reviewable, I took
the approach of adding libmultipath-based code, which would initially be
unused, and then finally making the full switch.

I think that more testing is required here and any help on that would be
appreciated.

The series is based on baa47c4f89eb (nvme/nvme-7.0) nvme-pci: do not
try to add queue maps at runtime and [0]

[0] https://lore.kernel.org/linux-block/20260225153225.1031169-1-john.g.garry@oracle.com/T/#m928333859c0320e57ece0dfcf4ecf58baae3220f

John Garry (19):
nvme-multipath: pass NS head to nvme_mpath_revalidate_paths()
nvme: introduce a namespace count in the ns head structure
nvme-multipath: add nvme_is_mpath_request()
nvme-multipath: add initial support for using libmultipath
nvme-multipath: add nvme_mpath_available_path()
nvme-multipath: add nvme_mpath_{add, remove}_cdev()
nvme-multipath: add nvme_mpath_is_{disabled, optimised}
nvme-multipath: add nvme_mpath_get_access_state()
nvme-multipath: add nvme_mpath_{bdev, cdev}_ioctl()
nvme-multipath: add uring_cmd support
nvme-multipath: add nvme_mpath_get_iopolicy()
nvme-multipath: add PR support for libmultipath
nvme-multipath: add nvme_mpath_report_zones()
nvme-multipath: add nvme_mpath_get_unique_id()
nvme-multipath: add nvme_mpath_synchronize()
nvme-multipath: add nvme_mpath_{add,delete}_ns()
nvme-multipath: add nvme_mpath_head_queue_if_no_path()
nvme-multipath: set mpath_head_template.device_groups
nvme-multipath: switch to use libmultipath

drivers/nvme/host/Kconfig | 1 +
drivers/nvme/host/core.c | 81 ++-
drivers/nvme/host/ioctl.c | 96 ++--
drivers/nvme/host/multipath.c | 962 +++++++++++-----------------------
drivers/nvme/host/nvme.h | 117 +++--
drivers/nvme/host/pr.c | 205 ++++++--
drivers/nvme/host/sysfs.c | 84 +--
7 files changed, 632 insertions(+), 914 deletions(-)

--
2.43.5