libmultipath: a generic multipath lib for block drivers#593
libmultipath: a generic multipath lib for block drivers#593blktests-ci[bot] wants to merge 13 commits intolinus-master_basefrom
Conversation
|
Upstream branch: 7dff99b |
c475e20 to
14f6b99
Compare
|
Upstream branch: a75cb86 |
ca0b65b to
4e13300
Compare
14f6b99 to
856dc37
Compare
|
Upstream branch: 4d349ee |
4e13300 to
011d487
Compare
856dc37 to
40967f0
Compare
|
Upstream branch: 11439c4 |
011d487 to
a540498
Compare
40967f0 to
d4e9bad
Compare
|
Upstream branch: af4e9ef |
a540498 to
d738009
Compare
ecd10e2 to
d0e1bed
Compare
|
Upstream branch: af4e9ef |
d738009 to
93cd20d
Compare
d0e1bed to
6b51c57
Compare
|
Upstream branch: 0031c06 |
93cd20d to
9626d5b
Compare
6b51c57 to
78036b2
Compare
|
Upstream branch: ecc64d2 |
9626d5b to
8287fd3
Compare
78036b2 to
bbb3394
Compare
|
Upstream branch: c107785 |
8287fd3 to
627d97f
Compare
c43a188 to
1a61b9f
Compare
e79276a to
0dd9afc
Compare
|
Upstream branch: 80234b5 |
1a61b9f to
2b99348
Compare
0dd9afc to
2e598ed
Compare
|
Upstream branch: 0257f64 |
2b99348 to
02b2551
Compare
1b884bd to
3ff0536
Compare
|
Upstream branch: 0257f64 |
02b2551 to
e78b3c0
Compare
3ff0536 to
868d59a
Compare
|
Upstream branch: a989fde |
e78b3c0 to
827f502
Compare
868d59a to
1f531be
Compare
Add initial framework for libmultipath. libmultipath is a library for multipath-capable block drivers, such as NVMe. The main function is to support path management, path selection, and failover handling. Basic support to add and remove the head structure - mpath_head - is included. This main purpose of this structure is to manage available paths and path selection. It is quite similar to the multipath functionality in nvme_ns_head. However a separate structure will introduced after to manage the multipath gendisk. Each path is represented by the mpath_device structure. It should hold a pointer to the per-path gendisk and also a list element for all siblings of paths. For NVMe, there would be a mpath_device per nvme_ns. All the libmultipath code is more or less taken from drivers/nvme/host/multipath.c, which was originally authored by Christoph Hellwig <hch@lst.de>. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to allocate and free a multipath gendisk. NVMe has almost like-for-like equivalents here: - mpath_alloc_head_disk() -> nvme_mpath_alloc_disk() - multipath_partition_scan_work() -> nvme_partition_scan_work() - mpath_remove_disk() -> nvme_remove_head() - mpath_device_set_live() -> nvme_mpath_set_live() struct mpath_head_template is introduced as a method for drivers to provide custom multipath functionality. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add code for path selection. NVMe ANA is abstracted into enum mpath_access_state. The motivation here is so that SCSI ALUA can be used. Callbacks .is_disabled, .is_optimized, .get_access_state are added to get the path access state. Path selection modes round-robin, NUMA, and queue-depth are added, same as NVMe supports. NVMe has almost like-for-like equivalents here: - __mpath_find_path() -> __nvme_find_path() - mpath_find_path() -> nvme_find_path() and similar for all introduced callee functions. Functions mpath_set_iopolicy() and mpath_get_iopolicy() are added for setting default iopolicy. A separate mpath_iopolicy structure is introduced. There is no iopolicy member included in the mpath_head structure as it may not suit NVMe, where iopolicy is per-subsystem and not per namespace. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to submit a bio per-path. In addition, for failover, add
support to requeue a failed bio.
NVMe has almost like-for-like equivalents here:
- nvme_available_path() -> mpath_available_path()
- nvme_requeue_work() -> mpath_requeue_work()
- nvme_ns_head_submit_bio() -> mpath_bdev_submit_bio()
For failover, a driver may want to re-submit a bio, so add support to
clone a bio prior to submission.
A bio which is submitted to a per-path device has flag REQ_MPATH set,
same as what is done for NVMe with REQ_NVME_MPATH.
Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to add or remove a mpath_device as a path. NVMe has almost like-for-like equivalents here: - nvme_mpath_clear_current_path() -> mpath_clear_current_path() - nvme_mpath_add_sysfs_link() -> mpath_add_sysfs_link() - nvme_mpath_remove_sysfs_link() -> mpath_remove_sysfs_link() - nvme_mpath_revalidate_paths() -> mpath_revalidate_paths() mpath_revalidate_paths() has a CB arg for NVMe specific handling. The functionality in mpath_clear_paths() and mpath_synchronize() have the same pattern which is frequently used in the NVMe code. Helper mpath_call_for_device() is added to allow a driver run a callback on any path available. It is intended to be used for occasions when the NVMe drivers accesses the list of paths outside its multipath code, like NVMe sysfs.c Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to create a cdev multipath device. The functionality is much the same as NVMe, where the cdev is created when a mpath device is set live. The driver must provide a mpath_head_template.cdev_ioctl callback to actually handle the ioctl. Structure mpath_generic_chr_fops would be used for setting the cdev fops in the mpath_head_template.add_cdev callback. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support for delayed removal, same as exists for NVMe. The purpose of this feature is to keep the multipath disk and cdev present for intermittent periods of no available path. Helpers mpath_delayed_removal_secs_show() and mpath_delayed_removal_secs_store() may be used in the driver sysfs code. The driver is responsible for supplying the removal work callback for the delayed work. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add helpers for driver sysfs code for the following functionality: - get/set iopolicy with mpath_iopolicy_store() and mpath_iopolicy_show() - show device path per NUMA node - "multipath" attribute group, equivalent to nvme_ns_mpath_attr_group - device groups attribute array, similar to nvme_ns_attr_groups but not containing NVMe members. Note that mpath_iopolicy_store() has a update callback to allow same functionality as nvme_subsys_iopolicy_update() be run for clearing paths. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support for persistent reservations. Effectively all that is done here is that a multipath version of pr_ops is created which calls into the driver version of the callbacks for the mpath_device selected. Structure mpath_pr_ops is introduced, which must be set by the driver for PR callbacks. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add a multipath handler for block_device_operations.report_zones Signed-off-by: John Garry <john.g.garry@oracle.com>
Add mpath_bdev_ioctl() as a multipath block device IOCTL handler. This handler calls into driver mpath_head_template.ioctl handler. It is expected that the .ioctl handler will unlock the SRCU read lock, as this is what NVMe requires - see nvme_ns_head_ctrl_ioctl(). As such, export a handler to unlock, mpath_head_read_unlock(). The .compat_ioctl handler is given the standard handler. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add mpath_bdev_getgeo() as a multipath block device .getgeo handler. Here we just redirect into the selected mpath_device disk fops->getgeo handler. Signed-off-by: John Garry <john.g.garry@oracle.com>
Add mpath_bdev_get_unique_id() as a multipath block device .get_unique_id handler. Signed-off-by: John Garry <john.g.garry@oracle.com>
|
Upstream branch: a989fde |
827f502 to
1cf1370
Compare
Pull request for series with
subject: libmultipath: a generic multipath lib for block drivers
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1057870