linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 7/7] nvme: micro optimize nvme_submit_priv
Date: Mon, 21 Sep 2015 11:40:53 -0700	[thread overview]
Message-ID: <1442860853-26447-8-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1442860853-26447-1-git-send-email-hch@lst.de>

Avoid a copy of the command from the request to the stack.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/block/nvme-core.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 6cc8f58..35236df 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -581,16 +581,15 @@ static int nvme_setup_prps(struct nvme_dev *dev, struct nvme_iod *iod,
 static void nvme_submit_priv(struct nvme_queue *nvmeq, struct request *req,
 		struct nvme_iod *iod)
 {
-	struct nvme_command cmnd;
+	struct nvme_command *cmnd = (struct nvme_command *)req->cmd;
 
-	memcpy(&cmnd, req->cmd, sizeof(cmnd));
-	cmnd.rw.command_id = req->tag;
+	cmnd->common.command_id = req->tag;
 	if (req->nr_phys_segments) {
-		cmnd.rw.prp1 = cpu_to_le64(sg_dma_address(iod->sg));
-		cmnd.rw.prp2 = cpu_to_le64(iod->first_dma);
+		cmnd->common.prp1 = cpu_to_le64(sg_dma_address(iod->sg));
+		cmnd->common.prp2 = cpu_to_le64(iod->first_dma);
 	}
 
-	__nvme_submit_cmd(nvmeq, &cmnd);
+	__nvme_submit_cmd(nvmeq, cmnd);
 }
 
 /*
-- 
1.9.1

      parent reply	other threads:[~2015-09-21 18:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21 18:40 nvme completion path optimizations and fixes Christoph Hellwig
2015-09-21 18:40 ` [PATCH 1/7] blk-mq: fix racy updates of rq->errors Christoph Hellwig
2015-09-27  7:35   ` Sagi Grimberg
2015-09-21 18:40 ` [PATCH 2/7] nvme: switch AEN processing to use blk_execute_rq_nowait Christoph Hellwig
2015-09-23 23:16   ` Keith Busch
2015-09-24 13:38     ` Christoph Hellwig
2015-09-24 13:51       ` Keith Busch
2015-09-25 22:11         ` Christoph Hellwig
2015-09-21 18:40 ` [PATCH 3/7] nvme: switch delete SQ/CQ to blk_execute_rq_nowait Christoph Hellwig
2015-09-21 18:40 ` [PATCH 4/7] nvme: switch abort " Christoph Hellwig
2015-09-21 18:40 ` [PATCH 5/7] nvme: simplify completion handling Christoph Hellwig
2015-09-21 18:40 ` [PATCH 6/7] nvme: properly free resources for cancelled command Christoph Hellwig
2015-09-21 18:40 ` Christoph Hellwig [this message]

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=1442860853-26447-8-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    /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;
as well as URLs for NNTP newsgroup(s).