[PATCH 05/14] nvmet: remove repeated call for changed-ns log page
Chaitanya Kulkarni
chaitanya.kulkarni at wdc.com
Sun Jun 27 22:08:08 PDT 2021
Return status from nvmet_execute_get_log_page_changed_ns() and complete
the request in nvmet_execute_get_log_page(). 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 <chaitanya.kulkarni at wdc.com>
---
drivers/nvme/target/admin-cmd.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 8c798559f1cc..2b018b84bf3f 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -221,14 +221,14 @@ static void nvmet_execute_get_log_cmd_effects_ns(struct nvmet_req *req)
nvmet_req_complete(req, status);
}
-static void nvmet_execute_get_log_changed_ns(struct nvmet_req *req)
+static u16 nvmet_execute_get_log_changed_ns(struct nvmet_req *req)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
u16 status = NVME_SC_INTERNAL;
size_t len;
if (req->transfer_len != NVME_MAX_CHANGED_NAMESPACES * sizeof(__le32))
- goto out;
+ return status;
mutex_lock(&ctrl->lock);
if (ctrl->nr_changed_ns == U32_MAX)
@@ -241,8 +241,8 @@ static void nvmet_execute_get_log_changed_ns(struct nvmet_req *req)
ctrl->nr_changed_ns = 0;
nvmet_clear_aen_bit(req, NVME_AEN_BIT_NS_ATTR);
mutex_unlock(&ctrl->lock);
-out:
- nvmet_req_complete(req, status);
+
+ return status;
}
static u32 nvmet_format_ana_group(struct nvmet_req *req, u32 grpid,
@@ -335,7 +335,8 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req)
status = nvmet_execute_get_log_page_noop(req);
break;
case NVME_LOG_CHANGED_NS:
- return nvmet_execute_get_log_changed_ns(req);
+ status = nvmet_execute_get_log_changed_ns(req);
+ break;
case NVME_LOG_CMD_EFFECTS:
return nvmet_execute_get_log_cmd_effects_ns(req);
case NVME_LOG_ANA:
--
2.22.1
More information about the Linux-nvme
mailing list