This series introduces libmultipath. It is essentially a refactoring of NVME multipath support, so we can have a common library to also support native SCSI multipath.
Much of the code is taken directly from the NVMe multipath code. However, NVMe specifics are removed. A template structure is provided so the driver may provide callbacks for driver specifics, like ANA support for NVMe. Important new structures introduced include: - mpath_head and mpath_disk These contain much of the multipath-specific functionality from nvme_ns_head. Seperate structures are needed to suit SCSI - that is because SCSI has concept of a scsi_driver, like scsi_disk. For SCSI, the mpath_head would be associated with the scsi_device, while mpath_disk would be associated with scsi_disk. - mpath_device This is the per-path structure, and contains the multipath-specific functionality in nvme_ns libmultipath provides functionality for path management, path selection, data path, and failover handling. Since the NVMe driver has some code in the sysfs and ioctl handling which iterate all multipath NSes, functions like mpath_call_for_device() are added to do the same per-path iteration. John Garry (13): libmultipath: Add initial framework libmultipath: Add basic gendisk support libmultipath: Add path selection support libmultipath: Add bio handling libmultipath: Add support for mpath_device management libmultipath: Add cdev support libmultipath: Add delayed removal support libmultipath: Add sysfs helpers libmultipath: Add PR support libmultipath: Add mpath_bdev_report_zones() libmultipath: Add support for block device IOCTL libmultipath: Add mpath_bdev_getgeo() libmultipath: Add mpath_bdev_get_unique_id() include/linux/multipath.h | 205 ++++++ lib/Kconfig | 6 + lib/Makefile | 2 + lib/multipath.c | 1261 +++++++++++++++++++++++++++++++++++++ 4 files changed, 1474 insertions(+) create mode 100644 include/linux/multipath.h create mode 100644 lib/multipath.c -- 2.43.5

