[PATCH 02/14] nvmet: remove repeated call for error log page

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Sun Jun 27 22:08:05 PDT 2021


Return status from nvmet_execute_get_log_page_error() and complete the
request in nvmet_execute_get_log_page(). This reduces number of
repeated nvmet_req_complete() calls for log page handlers.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/target/admin-cmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 03bfd8676456..66bb5b649ffd 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -45,7 +45,7 @@ static void nvmet_execute_get_log_page_noop(struct nvmet_req *req)
 	nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->transfer_len));
 }
 
-static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
+static u16 nvmet_execute_get_log_page_error(struct nvmet_req *req)
 {
 	struct nvmet_ctrl *ctrl = req->sq->ctrl;
 	unsigned long flags;
@@ -68,7 +68,7 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
 		offset += sizeof(struct nvme_error_slot);
 	}
 	spin_unlock_irqrestore(&ctrl->error_lock, flags);
-	nvmet_req_complete(req, 0);
+	return NVME_SC_SUCCESS;
 }
 
 static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
@@ -321,7 +321,8 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req)
 
 	switch (req->cmd->get_log_page.lid) {
 	case NVME_LOG_ERROR:
-		return nvmet_execute_get_log_page_error(req);
+		status = nvmet_execute_get_log_page_error(req);
+		break;
 	case NVME_LOG_SMART:
 		return nvmet_execute_get_log_page_smart(req);
 	case NVME_LOG_FW_SLOT:
-- 
2.22.1




More information about the Linux-nvme mailing list