All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-nvme@lists.infradead.org
Cc: hch@lst.de, sagi@grimberg.me,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [PATCH 01/14] nvmet: add common req complete for log page
Date: Sun, 27 Jun 2021 22:08:04 -0700	[thread overview]
Message-ID: <20210628050817.19788-2-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20210628050817.19788-1-chaitanya.kulkarni@wdc.com>

For set/get features command handlers we don't complete the request in
each feature handler instead we complete the request in the original
callback i.e. in nvmet_execute_set_feature() and
nvmet_execute_get_feature(). This reduces the number of repeated
nvmet_req_complete() calls needed for each feature to complete the
request.

A similar pattern can be used for the log page handler callback and its
helpers.

In this prep patch we add a default caes for unhandled log pages and
complete the request in the nvmet_execute_get_log_page(). Next patches
will use this call for request completion so we can remove the local
call from each log page handler.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.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 0cb98f2bbc8c..03bfd8676456 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -314,6 +314,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;
 
@@ -335,11 +337,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_err("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.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-06-28  5:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  5:08 [PATCH 00/14] nvmet: remove repeated calls to nvmet_req_complete() Chaitanya Kulkarni
2021-06-28  5:08 ` Chaitanya Kulkarni [this message]
2021-06-28  5:08 ` [PATCH 02/14] nvmet: remove repeated call for error log page Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 03/14] nvmet: remove repeated call for smart " Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 04/14] nvmet: remove repeated call for fw slot " Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 05/14] nvmet: remove repeated call for changed-ns " Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 06/14] nvmet: remove repeated call for effects " Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 07/14] nvmet: remove repeated call for ana " Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 08/14] nvmet: add default case for nvmet_execute_identify Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 09/14] nvmet: remove repeated call for id-ctrl Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 10/14] nvmet: remove repeated call for id-ns Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 11/14] nvmet: remove repeated call for nslist Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 12/14] nvmet: remove repeated call for desclist Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 13/14] nvmet: remove repeated call for id-cns-ns Chaitanya Kulkarni
2021-06-28  5:08 ` [PATCH 14/14] nvmet: remove repeated call for id-cns-ctrl Chaitanya Kulkarni
2021-07-16  7:36 ` [PATCH 00/14] nvmet: remove repeated calls to nvmet_req_complete() Christoph Hellwig

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=20210628050817.19788-2-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.