[PATCH 09/14] nvmet: remove repeated call for id-ctrl
From: Chaitanya Kulkarni <hidden>
Date: 2021-06-28 05:12:12
Subsystem:
nvm express target driver, the rest · Maintainers:
Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, Linus Torvalds
Return status from nvmet_execute_identidy_ctrl() and complete request in nvmet_execute_identify(). This reduces number of repeated nvmet_req_complete() calls for log page handlers. Also, now we can get rid of the goto and out label needed for request completion and directly return. Signed-off-by: Chaitanya Kulkarni <redacted> --- drivers/nvme/target/admin-cmd.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 28c24c08bd99..4f88276e0c48 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c@@ -349,7 +349,7 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req) nvmet_req_complete(req, status); } -static void nvmet_execute_identify_ctrl(struct nvmet_req *req) +static u16 nvmet_execute_identify_ctrl(struct nvmet_req *req) { struct nvmet_ctrl *ctrl = req->sq->ctrl; struct nvmet_subsys *subsys = ctrl->subsys;
@@ -364,10 +364,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) } id = kzalloc(sizeof(*id), GFP_KERNEL); - if (!id) { - status = NVME_SC_INTERNAL; - goto out; - } + if (!id) + return NVME_SC_INTERNAL; /* XXX: figure out how to assign real vendors IDs. */ id->vid = 0;
@@ -484,8 +482,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); kfree(id); -out: - nvmet_req_complete(req, status); + + return status; } static void nvmet_execute_identify_ns(struct nvmet_req *req)
@@ -709,7 +707,8 @@ static void nvmet_execute_identify(struct nvmet_req *req) case NVME_ID_CNS_CTRL: switch (req->cmd->identify.csi) { case NVME_CSI_NVM: - return nvmet_execute_identify_ctrl(req); + status = nvmet_execute_identify_ctrl(req); + break; } break; case NVME_ID_CNS_CS_CTRL:
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme