All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>, Keith Busch <keith.busch@intel.com>,
	Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: [PATCH 4/5] nvme: move the retries count to struct nvme_request
Date: Wed,  5 Apr 2017 16:18:55 +0200	[thread overview]
Message-ID: <20170405141856.1862-5-hch@lst.de> (raw)
In-Reply-To: <20170405141856.1862-1-hch@lst.de>

The way NVMe uses this field is entirely different from the older
SCSI/BLOCK_PC usage, so move it into struct nvme_request.

Also reduce the size of the file to a unsigned char so that we leave space
for additional smaller fields that will appear soon.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 10 +++++-----
 drivers/nvme/host/nvme.h |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 933e67c60e33..dc05f41c3992 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -49,8 +49,8 @@ unsigned char shutdown_timeout = 5;
 module_param(shutdown_timeout, byte, 0644);
 MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
 
-static unsigned int nvme_max_retries = 5;
-module_param_named(max_retries, nvme_max_retries, uint, 0644);
+static u8 nvme_max_retries = 5;
+module_param_named(max_retries, nvme_max_retries, byte, 0644);
 MODULE_PARM_DESC(max_retries, "max number of retries a command may have");
 
 static int nvme_char_major;
@@ -74,7 +74,7 @@ static inline bool nvme_req_needs_retry(struct request *req)
 		return false;
 	if (jiffies - req->start_time >= req->timeout)
 		return false;
-	if (req->retries >= nvme_max_retries)
+	if (nvme_req(req)->retries >= nvme_max_retries)
 		return false;
 	return true;
 }
@@ -85,7 +85,7 @@ void nvme_complete_rq(struct request *req)
 
 	if (unlikely(req->errors)) {
 		if (nvme_req_needs_retry(req)) {
-			req->retries++;
+			nvme_req(req)->retries++;
 			blk_mq_requeue_request(req,
 					!blk_mq_queue_stopped(req->q));
 			return;
@@ -356,7 +356,7 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
 	int ret = BLK_MQ_RQ_QUEUE_OK;
 
 	if (!(req->rq_flags & RQF_DONTPREP)) {
-		req->retries = 0;
+		nvme_req(req)->retries = 0;
 		req->rq_flags |= RQF_DONTPREP;
 	}
 
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 82ba9a305301..b667be9546a1 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -89,6 +89,7 @@ enum nvme_quirks {
  */
 struct nvme_request {
 	struct nvme_command	*cmd;
+	u8			retries;
 	union nvme_result	result;
 };
 
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 4/5] nvme: move the retries count to struct nvme_request
Date: Wed,  5 Apr 2017 16:18:55 +0200	[thread overview]
Message-ID: <20170405141856.1862-5-hch@lst.de> (raw)
In-Reply-To: <20170405141856.1862-1-hch@lst.de>

The way NVMe uses this field is entirely different from the older
SCSI/BLOCK_PC usage, so move it into struct nvme_request.

Also reduce the size of the file to a unsigned char so that we leave space
for additional smaller fields that will appear soon.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/core.c | 10 +++++-----
 drivers/nvme/host/nvme.h |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 933e67c60e33..dc05f41c3992 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -49,8 +49,8 @@ unsigned char shutdown_timeout = 5;
 module_param(shutdown_timeout, byte, 0644);
 MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
 
-static unsigned int nvme_max_retries = 5;
-module_param_named(max_retries, nvme_max_retries, uint, 0644);
+static u8 nvme_max_retries = 5;
+module_param_named(max_retries, nvme_max_retries, byte, 0644);
 MODULE_PARM_DESC(max_retries, "max number of retries a command may have");
 
 static int nvme_char_major;
@@ -74,7 +74,7 @@ static inline bool nvme_req_needs_retry(struct request *req)
 		return false;
 	if (jiffies - req->start_time >= req->timeout)
 		return false;
-	if (req->retries >= nvme_max_retries)
+	if (nvme_req(req)->retries >= nvme_max_retries)
 		return false;
 	return true;
 }
@@ -85,7 +85,7 @@ void nvme_complete_rq(struct request *req)
 
 	if (unlikely(req->errors)) {
 		if (nvme_req_needs_retry(req)) {
-			req->retries++;
+			nvme_req(req)->retries++;
 			blk_mq_requeue_request(req,
 					!blk_mq_queue_stopped(req->q));
 			return;
@@ -356,7 +356,7 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
 	int ret = BLK_MQ_RQ_QUEUE_OK;
 
 	if (!(req->rq_flags & RQF_DONTPREP)) {
-		req->retries = 0;
+		nvme_req(req)->retries = 0;
 		req->rq_flags |= RQF_DONTPREP;
 	}
 
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 82ba9a305301..b667be9546a1 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -89,6 +89,7 @@ enum nvme_quirks {
  */
 struct nvme_request {
 	struct nvme_command	*cmd;
+	u8			retries;
 	union nvme_result	result;
 };
 
-- 
2.11.0

  parent reply	other threads:[~2017-04-05 14:18 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 14:18 ->retries fixups Christoph Hellwig
2017-04-05 14:18 ` Christoph Hellwig
2017-04-05 14:18 ` [PATCH 1/5] nvme: move ->retries setup to nvme_setup_cmd Christoph Hellwig
2017-04-05 14:18   ` Christoph Hellwig
2017-04-05 14:43   ` Johannes Thumshirn
2017-04-05 14:43     ` Johannes Thumshirn
2017-04-05 14:43     ` Johannes Thumshirn
2017-04-05 14:50     ` Christoph Hellwig
2017-04-05 14:50       ` Christoph Hellwig
2017-04-05 14:18 ` [PATCH 2/5] nvme: cleanup nvme_req_needs_retry Christoph Hellwig
2017-04-05 14:18   ` Christoph Hellwig
2017-04-05 14:42   ` Johannes Thumshirn
2017-04-05 14:42     ` Johannes Thumshirn
2017-04-05 14:42     ` Johannes Thumshirn
2017-04-05 14:18 ` [PATCH 3/5] nvme: mark nvme_max_retries static Christoph Hellwig
2017-04-05 14:18   ` Christoph Hellwig
2017-04-05 14:44   ` Johannes Thumshirn
2017-04-05 14:44     ` Johannes Thumshirn
2017-04-05 14:44     ` Johannes Thumshirn
2017-04-05 14:18 ` Christoph Hellwig [this message]
2017-04-05 14:18   ` [PATCH 4/5] nvme: move the retries count to struct nvme_request Christoph Hellwig
2017-04-05 14:45   ` Johannes Thumshirn
2017-04-05 14:45     ` Johannes Thumshirn
2017-04-05 14:45     ` Johannes Thumshirn
2017-04-05 15:14   ` Keith Busch
2017-04-05 15:14     ` Keith Busch
2017-04-05 15:25     ` Christoph Hellwig
2017-04-05 15:25       ` Christoph Hellwig
2017-04-06  8:35     ` 廖亨权
2017-04-06  8:38       ` Christoph Hellwig
2017-04-06  8:38         ` Christoph Hellwig
2017-04-05 14:18 ` [PATCH 5/5] block, scsi: move the retries field to struct scsi_request Christoph Hellwig
2017-04-05 14:18   ` Christoph Hellwig
2017-04-05 14:46   ` Johannes Thumshirn
2017-04-05 14:46     ` Johannes Thumshirn
2017-04-05 14:46     ` Johannes Thumshirn
2017-04-05 17:18 ->retries fixups V2 Christoph Hellwig
2017-04-05 17:18 ` [PATCH 4/5] nvme: move the retries count to struct nvme_request Christoph Hellwig
2017-04-05 17:18   ` Christoph Hellwig
2017-04-05 17:33   ` Sagi Grimberg
2017-04-05 17:33     ` Sagi Grimberg

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=20170405141856.1862-5-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.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.