Add a function to return the iopolicy for the head structure. Since iopolicy for NVMe is currently per-subsysten, we add the mpath_iopolicy struct to the subsystem struct, and nvme_mpath_get_iopolicy() needs to access that member.
Signed-off-by: John Garry <[email protected]> --- drivers/nvme/host/multipath.c | 9 +++++++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index a51944ca56b1f..8025cf3270cdc 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -1438,6 +1438,14 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl) ctrl->ana_log_size = 0; } +static enum mpath_iopolicy_e nvme_mpath_get_iopolicy( + struct mpath_head *mpath_head) +{ + struct nvme_ns_head *head = mpath_head->drvdata; + + return mpath_read_iopolicy(&head->subsys->mpath_iopolicy); +} + __maybe_unused static const struct mpath_head_template mpdt = { .available_path = nvme_mpath_available_path, @@ -1450,4 +1458,5 @@ static const struct mpath_head_template mpdt = { .ioctl_finish = nvme_mpath_ioctl_finish, .chr_uring_cmd = nvme_mpath_chr_uring_cmd, .chr_uring_cmd_iopoll = nvme_ns_chr_uring_cmd_iopoll, + .get_iopolicy = nvme_mpath_get_iopolicy, }; diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index efa868ba3fbf8..01a7a25bcd254 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -502,6 +502,7 @@ struct nvme_subsystem { struct ida ns_ida; #ifdef CONFIG_NVME_MULTIPATH enum nvme_iopolicy iopolicy; + struct mpath_iopolicy mpath_iopolicy; #endif }; -- 2.43.5

