All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: sagi@grimberg.me, hch@lst.de,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [PATCH 3/9] nvmet: trim down id-desclist to use req->ns
Date: Wed, 25 Nov 2020 18:40:37 -0800	[thread overview]
Message-ID: <20201126024043.3392-4-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20201126024043.3392-1-chaitanya.kulkarni@wdc.com>

In this prep patch we remove the extra local variable struct nvmet_ns
in nvmet_execute_identify_desclist() since req already has the member
that can be reused, this also eliminates the explicit call to
nvmet_put_namespace() which is already present in the request
completion path.

This reduces the arguments to the function in the following patch to
implement the ZNS for bdev-ns so we can get away with passing the req
argument instead of req and ns.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/target/admin-cmd.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 509fd8dcca0c..c64b40c631e0 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -603,37 +603,35 @@ u16 nvmet_copy_ns_identifier(struct nvmet_req *req, u8 type, u8 len,
 
 static void nvmet_execute_identify_desclist(struct nvmet_req *req)
 {
-	struct nvmet_ns *ns;
 	u16 status = 0;
 	off_t off = 0;
 
-	ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid);
-	if (!ns) {
+	req->ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid);
+	if (!req->ns) {
 		req->error_loc = offsetof(struct nvme_identify, nsid);
 		status = NVME_SC_INVALID_NS | NVME_SC_DNR;
 		goto out;
 	}
 
-	if (memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {
+	if (memchr_inv(&req->ns->uuid, 0, sizeof(req->ns->uuid))) {
 		status = nvmet_copy_ns_identifier(req, NVME_NIDT_UUID,
 						  NVME_NIDT_UUID_LEN,
-						  &ns->uuid, &off);
+						  &req->ns->uuid, &off);
 		if (status)
-			goto out_put_ns;
+			goto out;
 	}
-	if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) {
+	if (memchr_inv(req->ns->nguid, 0, sizeof(req->ns->nguid))) {
 		status = nvmet_copy_ns_identifier(req, NVME_NIDT_NGUID,
 						  NVME_NIDT_NGUID_LEN,
-						  &ns->nguid, &off);
+						  &req->ns->nguid, &off);
 		if (status)
-			goto out_put_ns;
+			goto out;
 	}
 
 	if (sg_zero_buffer(req->sg, req->sg_cnt, NVME_IDENTIFY_DATA_SIZE - off,
 			off) != NVME_IDENTIFY_DATA_SIZE - off)
 		status = NVME_SC_INTERNAL | NVME_SC_DNR;
-out_put_ns:
-	nvmet_put_namespace(ns);
+
 out:
 	nvmet_req_complete(req, status);
 }
-- 
2.22.1


WARNING: multiple messages have this Message-ID (diff)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: sagi@grimberg.me, Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	hch@lst.de
Subject: [PATCH 3/9] nvmet: trim down id-desclist to use req->ns
Date: Wed, 25 Nov 2020 18:40:37 -0800	[thread overview]
Message-ID: <20201126024043.3392-4-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20201126024043.3392-1-chaitanya.kulkarni@wdc.com>

In this prep patch we remove the extra local variable struct nvmet_ns
in nvmet_execute_identify_desclist() since req already has the member
that can be reused, this also eliminates the explicit call to
nvmet_put_namespace() which is already present in the request
completion path.

This reduces the arguments to the function in the following patch to
implement the ZNS for bdev-ns so we can get away with passing the req
argument instead of req and ns.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/target/admin-cmd.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 509fd8dcca0c..c64b40c631e0 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -603,37 +603,35 @@ u16 nvmet_copy_ns_identifier(struct nvmet_req *req, u8 type, u8 len,
 
 static void nvmet_execute_identify_desclist(struct nvmet_req *req)
 {
-	struct nvmet_ns *ns;
 	u16 status = 0;
 	off_t off = 0;
 
-	ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid);
-	if (!ns) {
+	req->ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid);
+	if (!req->ns) {
 		req->error_loc = offsetof(struct nvme_identify, nsid);
 		status = NVME_SC_INVALID_NS | NVME_SC_DNR;
 		goto out;
 	}
 
-	if (memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) {
+	if (memchr_inv(&req->ns->uuid, 0, sizeof(req->ns->uuid))) {
 		status = nvmet_copy_ns_identifier(req, NVME_NIDT_UUID,
 						  NVME_NIDT_UUID_LEN,
-						  &ns->uuid, &off);
+						  &req->ns->uuid, &off);
 		if (status)
-			goto out_put_ns;
+			goto out;
 	}
-	if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) {
+	if (memchr_inv(req->ns->nguid, 0, sizeof(req->ns->nguid))) {
 		status = nvmet_copy_ns_identifier(req, NVME_NIDT_NGUID,
 						  NVME_NIDT_NGUID_LEN,
-						  &ns->nguid, &off);
+						  &req->ns->nguid, &off);
 		if (status)
-			goto out_put_ns;
+			goto out;
 	}
 
 	if (sg_zero_buffer(req->sg, req->sg_cnt, NVME_IDENTIFY_DATA_SIZE - off,
 			off) != NVME_IDENTIFY_DATA_SIZE - off)
 		status = NVME_SC_INTERNAL | NVME_SC_DNR;
-out_put_ns:
-	nvmet_put_namespace(ns);
+
 out:
 	nvmet_req_complete(req, status);
 }
-- 
2.22.1


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

  parent reply	other threads:[~2020-11-26  2:41 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  2:40 [PATCH 0/9] nvmet: add genblk ZBD backend Chaitanya Kulkarni
2020-11-26  2:40 ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 1/9] block: export __bio_iov_append_get_pages() Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:09   ` Damien Le Moal
2020-11-26  8:09     ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 2/9] nvmet: add ZNS support for bdev-ns Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:36   ` Damien Le Moal
2020-11-26  8:36     ` Damien Le Moal
2020-11-28  0:09     ` Chaitanya Kulkarni
2020-11-28  0:09       ` Chaitanya Kulkarni
2020-11-30  0:16       ` Damien Le Moal
2020-11-30  0:16         ` Damien Le Moal
2020-11-26  9:06   ` Damien Le Moal
2020-11-26  9:06     ` Damien Le Moal
     [not found]     ` <BYAPR04MB496572575C9B29E682B0C25286F70@BYAPR04MB4965.namprd04.prod.outlook.com>
2020-11-30  0:18       ` Damien Le Moal
2020-11-30  0:18         ` Damien Le Moal
2020-11-26  2:40 ` Chaitanya Kulkarni [this message]
2020-11-26  2:40   ` [PATCH 3/9] nvmet: trim down id-desclist to use req->ns Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 4/9] nvmet: add NVME_CSI_ZNS in ns-desc for zbdev Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 5/9] nvmet: add cns-cs-ctrl in id-ctrl for ZNS bdev Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:39   ` Damien Le Moal
2020-11-26  8:39     ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 6/9] nvmet: add cns-cs-ns " Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:40   ` Damien Le Moal
2020-11-26  8:40     ` Damien Le Moal
     [not found]     ` <BYAPR04MB4965E885FFD93A530AF315B886F70@BYAPR04MB4965.namprd04.prod.outlook.com>
2020-11-30  0:21       ` Damien Le Moal
2020-11-30  0:21         ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 7/9] nvmet: add zns cmd effects to support zbdev Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:40   ` Damien Le Moal
2020-11-26  8:40     ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 8/9] nvmet: add zns bdev config support Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 9/9] nvmet: add ZNS based I/O cmds handlers Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:45   ` Damien Le Moal
2020-11-26  8:45     ` Damien Le Moal
2020-11-26  8:07 ` [PATCH 0/9] nvmet: add genblk ZBD backend Damien Le Moal
2020-11-26  8:07   ` Damien Le Moal

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=20201126024043.3392-4-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.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 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.