summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McLeran <daniel.mcleran@intel.com>2014-07-01 09:33:32 -0600
committerJens Axboe <axboe@fb.com>2014-11-04 13:17:08 -0700
commit2484f40780b97df1b5eb09e78ce4efaa78b21875 (patch)
tree5de1151b759014f8b25b4936279902520b47deb0
parent7c1b24503873e6cfc1d31f2e55c35358fd438351 (diff)
downloadlinux-2484f40780b97df1b5eb09e78ce4efaa78b21875.tar.gz
linux-2484f40780b97df1b5eb09e78ce4efaa78b21875.tar.bz2
linux-2484f40780b97df1b5eb09e78ce4efaa78b21875.zip
NVMe: Add shutdown timeout as module parameter.
The current implementation hard-codes the shutdown timeout to 2 seconds. Some devices take longer than this to complete a normal shutdown. Changing the shutdown timeout to a module parameter with a default timeout of 5 seconds. Signed-off-by: Dan McLeran <daniel.mcleran@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/block/nvme-core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index ac3694083e89..3ada636356e8 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -48,6 +48,7 @@
#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command))
#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion))
#define ADMIN_TIMEOUT (admin_timeout * HZ)
+#define SHUTDOWN_TIMEOUT (shutdown_timeout * HZ)
#define IOD_TIMEOUT (retry_time * HZ)
static unsigned char admin_timeout = 60;
@@ -62,6 +63,10 @@ static unsigned char retry_time = 30;
module_param(retry_time, byte, 0644);
MODULE_PARM_DESC(retry_time, "time in seconds to retry failed I/O");
+static unsigned char shutdown_timeout = 5;
+module_param(shutdown_timeout, byte, 0644);
+MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
+
static int nvme_major;
module_param(nvme_major, int, 0);
@@ -1447,7 +1452,7 @@ static int nvme_shutdown_ctrl(struct nvme_dev *dev)
writel(dev->ctrl_config, &dev->bar->cc);
- timeout = 2 * HZ + jiffies;
+ timeout = SHUTDOWN_TIMEOUT + jiffies;
while ((readl(&dev->bar->csts) & NVME_CSTS_SHST_MASK) !=
NVME_CSTS_SHST_CMPLT) {
msleep(100);