Add a wrapper to call into mpath_head_queue_if_no_path().

The mpath_disk is added as we can be called from paths when the mpath_head
has not been allocated.

Signed-off-by: John Garry <[email protected]>
---
 drivers/nvme/host/multipath.c | 10 ++++++++++
 drivers/nvme/host/nvme.h      |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index bd96211123fee..fdb7f3b55a197 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -214,6 +214,16 @@ void nvme_mpath_end_request(struct request *rq)
                         nvme_req(rq)->start_time);
 }
 
+bool nvme_mpath_head_queue_if_no_path(struct nvme_ns_head *head)
+{
+       struct mpath_disk *mpath_disk = head->mpath_disk;
+
+       if (!mpath_disk)
+               return false;
+
+       return mpath_head_queue_if_no_path(mpath_disk->mpath_head);
+}
+
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
 {
        struct nvme_ns *ns;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 3c08212e4a54f..e276a7bcb7aff 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -1052,6 +1052,7 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl);
 void nvme_mpath_remove_disk(struct nvme_ns_head *head);
 void nvme_mpath_start_request(struct request *rq);
 void nvme_mpath_end_request(struct request *rq);
+bool nvme_mpath_head_queue_if_no_path(struct nvme_ns_head *head);
 int nvme_mpath_bdev_ioctl(struct block_device *bdev,
                struct mpath_device *mpath_device, blk_mode_t mode,
                unsigned int cmd, unsigned long arg, int srcu_idx);
@@ -1196,6 +1197,10 @@ static inline bool nvme_mpath_queue_if_no_path(struct 
nvme_ns_head *head)
 {
        return false;
 }
+static inline bool nvme_mpath_head_queue_if_no_path(struct nvme_ns_head *head)
+{
+       return false;
+}
 #endif /* CONFIG_NVME_MULTIPATH */
 
 int nvme_ns_get_unique_id(struct nvme_ns *ns, u8 id[16],
-- 
2.43.5


Reply via email to