aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme-core.c
diff options
context:
space:
mode:
authorDan McLeran <daniel.mcleran@intel.com>2014-07-01 11:33:32 -0400
committerJens Axboe <axboe@fb.com>2014-11-04 15:17:08 -0500
commit2484f40780b97df1b5eb09e78ce4efaa78b21875 (patch)
tree5de1151b759014f8b25b4936279902520b47deb0 /drivers/block/nvme-core.c
parent7c1b24503873e6cfc1d31f2e55c35358fd438351 (diff)
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>
Diffstat (limited to 'drivers/block/nvme-core.c')
-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 @@
48#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command)) 48#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command))
49#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion)) 49#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion))
50#define ADMIN_TIMEOUT (admin_timeout * HZ) 50#define ADMIN_TIMEOUT (admin_timeout * HZ)
51#define SHUTDOWN_TIMEOUT (shutdown_timeout * HZ)
51#define IOD_TIMEOUT (retry_time * HZ) 52#define IOD_TIMEOUT (retry_time * HZ)
52 53
53static unsigned char admin_timeout = 60; 54static unsigned char admin_timeout = 60;
@@ -62,6 +63,10 @@ static unsigned char retry_time = 30;
62module_param(retry_time, byte, 0644); 63module_param(retry_time, byte, 0644);
63MODULE_PARM_DESC(retry_time, "time in seconds to retry failed I/O"); 64MODULE_PARM_DESC(retry_time, "time in seconds to retry failed I/O");
64 65
66static unsigned char shutdown_timeout = 5;
67module_param(shutdown_timeout, byte, 0644);
68MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
69
65static int nvme_major; 70static int nvme_major;
66module_param(nvme_major, int, 0); 71module_param(nvme_major, int, 0);
67 72
@@ -1447,7 +1452,7 @@ static int nvme_shutdown_ctrl(struct nvme_dev *dev)
1447 1452
1448 writel(dev->ctrl_config, &dev->bar->cc); 1453 writel(dev->ctrl_config, &dev->bar->cc);
1449 1454
1450 timeout = 2 * HZ + jiffies; 1455 timeout = SHUTDOWN_TIMEOUT + jiffies;
1451 while ((readl(&dev->bar->csts) & NVME_CSTS_SHST_MASK) != 1456 while ((readl(&dev->bar->csts) & NVME_CSTS_SHST_MASK) !=
1452 NVME_CSTS_SHST_CMPLT) { 1457 NVME_CSTS_SHST_CMPLT) {
1453 msleep(100); 1458 msleep(100);