Add a wrapper which calls into mpath_synchronize.

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      |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 15fba20cded67..7ee0ad7bdfa26 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -972,6 +972,16 @@ static void nvme_update_ns_ana_state(struct 
nvme_ana_group_desc *desc,
        }
 }
 
+void nvme_mpath_synchronize(struct nvme_ns_head *head)
+{
+       struct mpath_disk *mpath_disk = head->mpath_disk;
+
+       if (!mpath_disk)
+               return;
+
+       mpath_synchronize(mpath_disk->mpath_head);
+}
+
 static int nvme_update_ana_state(struct nvme_ctrl *ctrl,
                struct nvme_ana_group_desc *desc, void *data)
 {
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 619d2fff969e3..d642b0eddf010 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -1027,6 +1027,7 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl 
*ctrl)
        return ctrl->ana_log_buf != NULL;
 }
 
+void nvme_mpath_synchronize(struct nvme_ns_head *head);
 void nvme_mpath_unfreeze(struct nvme_subsystem *subsys);
 void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys);
 void nvme_mpath_start_freeze(struct nvme_subsystem *subsys);
@@ -1095,6 +1096,9 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctrl 
*ctrl)
 {
        return false;
 }
+static inline void nvme_mpath_synchronize(struct nvme_ns_head *head)
+{
+}
 static inline void nvme_failover_req(struct request *req)
 {
 }
-- 
2.43.5


Reply via email to