From ddd18c731f7441e8026bf4407dd618ff55cfbbf7 Mon Sep 17 00:00:00 2001 From: Paul Grabinar Date: Thu, 23 Jul 2015 21:43:29 +0100 Subject: [PATCH] Allow longer timeout for format Some NVMe drives take longer than 60 seconds to perform a format on a namespace. Increase the timeout for the format to 120 seconds. --- nvme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvme.c b/nvme.c index 02f4deca..5c99dea0 100644 --- a/nvme.c +++ b/nvme.c @@ -51,6 +51,8 @@ #define min(x, y) (x) > (y) ? (y) : (x) +#define FORMAT_TIMEOUT 120000 // 120 seconds + static int fd; static struct stat nvme_stat; static const char *devicename; @@ -2132,6 +2134,7 @@ static int format(int argc, char **argv) cmd.opcode = nvme_admin_format_nvm; cmd.nsid = cfg.namespace_id; cmd.cdw10 = (cfg.lbaf << 0) | (cfg.ms << 4) | (cfg.pi << 5) | (cfg.pil << 8) | (cfg.ses << 9); + cmd.timeout_ms = FORMAT_TIMEOUT; err = ioctl(fd, NVME_IOCTL_ADMIN_CMD, &cmd); if (err < 0) -- 2.50.1