[PATCH 4/8] nvme: add nvme_queue_scan_sync helper

Max Gurtovoy mgurtovoy at nvidia.com
Mon Jan 22 06:56:55 PST 2024


This is a preparation patch for synchronizing the scanning during the
start of the controller.

This patch doesn't change any logic.

Reviewed-by: Israel Rukshin <israelr at nvidia.com>
Signed-off-by: Max Gurtovoy <mgurtovoy at nvidia.com>
---
 drivers/nvme/host/core.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4fd3612b7570..d0e4888041aa 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -144,6 +144,12 @@ void nvme_queue_scan(struct nvme_ctrl *ctrl)
 		queue_work(nvme_wq, &ctrl->scan_work);
 }
 
+static void nvme_queue_scan_sync(struct nvme_ctrl *ctrl)
+{
+	nvme_queue_scan(ctrl);
+	flush_work(&ctrl->scan_work);
+}
+
 /*
  * Use this function to proceed with scheduling reset_work for a controller
  * that had previously been set to the resetting state. This is intended for
@@ -1156,10 +1162,8 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effects,
 "controller capabilities changed, reset may be required to take effect.\n");
 		}
 	}
-	if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) {
-		nvme_queue_scan(ctrl);
-		flush_work(&ctrl->scan_work);
-	}
+	if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC))
+		nvme_queue_scan_sync(ctrl);
 	if (ns)
 		return;
 
-- 
2.18.1




More information about the Linux-nvme mailing list