public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-nvme@lists.infradead.org>
Cc: <kbusch@kernel.org>, <hch@lst.de>, <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH 1/7] nvmet: prep to callers req completion for log
Date: Thu, 23 Mar 2023 00:51:57 -0700	[thread overview]
Message-ID: <20230323075203.824096-2-kch@nvidia.com> (raw)
In-Reply-To: <20230323075203.824096-1-kch@nvidia.com>

In order to use request completion in nvmet_execute_get_log_page()
and remove repeated calls for nvmet_req_complete() in :-
nvmet_execute_get_log_page_error()
nvmet_execute_get_log_page_smart()
nvmet_execute_get_log_page_noop()
nvmet_execute_get_log_changed_ns(),
nvmet_execute_get_log_cmd_effects_ns() 
nvmet_execute_get_log_page_ana()

add default case for swicth so we will report appropriate error and
keep the backward compatibility.

Please note that this is not a pattern and is present in the
nvmet_execute_set_feature() that save current and future repeated
calls for nvmet_req_completion().

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/nvme/target/admin-cmd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 39cb570f833d..45e4ba2a498e 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -319,6 +319,8 @@ static void nvmet_execute_get_log_page_ana(struct nvmet_req *req)
 
 static void nvmet_execute_get_log_page(struct nvmet_req *req)
 {
+	u16 status;
+
 	if (!nvmet_check_transfer_len(req, nvmet_get_log_page_len(req->cmd)))
 		return;
 
@@ -340,11 +342,13 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req)
 		return nvmet_execute_get_log_cmd_effects_ns(req);
 	case NVME_LOG_ANA:
 		return nvmet_execute_get_log_page_ana(req);
+	default:
+		pr_debug("unhandled lid %d on qid %d\n",
+			 req->cmd->get_log_page.lid, req->sq->qid);
+		req->error_loc = offsetof(struct nvme_get_log_page_command, lid);
+		status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
 	}
-	pr_debug("unhandled lid %d on qid %d\n",
-	       req->cmd->get_log_page.lid, req->sq->qid);
-	req->error_loc = offsetof(struct nvme_get_log_page_command, lid);
-	nvmet_req_complete(req, NVME_SC_INVALID_FIELD | NVME_SC_DNR);
+	nvmet_req_complete(req, status);
 }
 
 static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
-- 
2.29.0



  reply	other threads:[~2023-03-23  7:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  7:51 [PATCH 0/7] nvmet: use centralize req completion for log Chaitanya Kulkarni
2023-03-23  7:51 ` Chaitanya Kulkarni [this message]
2023-03-23  7:51 ` [PATCH 2/7] nvmet: centralize req completion for err log Chaitanya Kulkarni
2023-03-23  7:51 ` [PATCH 3/7] nvmet: centralize req completion for smart log Chaitanya Kulkarni
2023-03-23  7:52 ` [PATCH 4/7] nvmet: centralize req completion for noop log Chaitanya Kulkarni
2023-03-23  7:52 ` [PATCH 5/7] nvmet: centralize req completion for change ns Chaitanya Kulkarni
2023-03-23  7:52 ` [PATCH 6/7] nvmet: centralize req completion for effects log Chaitanya Kulkarni
2023-03-23  7:52 ` [PATCH 7/7] nvmet: centralize req completion for ana log Chaitanya Kulkarni
2023-03-23  8:34 ` [PATCH 0/7] nvmet: use centralize req completion for log Sagi Grimberg
2023-03-28  0:59 ` Christoph Hellwig
2023-03-28  5:18   ` Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230323075203.824096-2-kch@nvidia.com \
    --to=kch@nvidia.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox