[PATCH 03/14] nvmet: remove repeated call for smart log page
Chaitanya Kulkarni
chaitanya.kulkarni at wdc.com
Sun Jun 27 22:08:06 PDT 2021
Return status from nvmet_execute_get_log_page_smart() and complete the
request in nvmet_execute_get_log_page(). This reduces number of
repeated nvmet_req_complete() calls for log page handlers.
Also, this allows us to remove the goto out label.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
drivers/nvme/target/admin-cmd.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 66bb5b649ffd..079fe04d0ee6 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -130,18 +130,18 @@ static u16 nvmet_get_smart_log_all(struct nvmet_req *req,
return NVME_SC_SUCCESS;
}
-static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
+static u16 nvmet_execute_get_log_page_smart(struct nvmet_req *req)
{
struct nvme_smart_log *log;
u16 status = NVME_SC_INTERNAL;
unsigned long flags;
if (req->transfer_len != sizeof(*log))
- goto out;
+ return status;
log = kzalloc(sizeof(*log), GFP_KERNEL);
if (!log)
- goto out;
+ return status;
if (req->cmd->get_log_page.nsid == cpu_to_le32(NVME_NSID_ALL))
status = nvmet_get_smart_log_all(req, log);
@@ -158,8 +158,8 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
out_free_log:
kfree(log);
-out:
- nvmet_req_complete(req, status);
+
+ return status;
}
static void nvmet_get_cmd_effects_nvm(struct nvme_effects_log *log)
@@ -324,7 +324,8 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req)
status = nvmet_execute_get_log_page_error(req);
break;
case NVME_LOG_SMART:
- return nvmet_execute_get_log_page_smart(req);
+ status = nvmet_execute_get_log_page_smart(req);
+ break;
case NVME_LOG_FW_SLOT:
/*
* We only support a single firmware slot which always is
--
2.22.1
More information about the Linux-nvme
mailing list