Skip to contentSkip to conversation

nvme-cli format timeout

PATCH Paul Grabinar 2 participants 3 messages Jul 23, 2015 NVMe

lore
Share & tools
lore
#0 lore raw

Hi,

I am aware of some NVMe drives that take well over 60 seconds to perform a format and therefore timeout during the format command issued by nvme-cli.

We might want to consider increasing the timeout. The following patch is an example to show what I mean.

Thanks.

nvme.c +3 -0
index 02f4dec..5c99dea 100644
@@ -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)
#1 lore raw
Quoted 7 lines · Paul Grabinar

Hi,

I am aware of some NVMe drives that take well over 60 seconds to perform a format and therefore timeout during the format command issued by nvme-cli.

We might want to consider increasing the timeout. The following patch is an example to show what I mean.

Good idea. We should probably make this a parameter as well as up the timeout. Only the passthru command takes the timeout request as a parameter for some reason.

If you want to post a pull request on github, we can apply it from there.

#2 lore raw
Quoted 7 lines · Keith Busch
Quoted 6 lines · Paul Grabinar

Hi,

I am aware of some NVMe drives that take well over 60 seconds to perform a format and therefore timeout during the format command issued by nvme-cli.

Quoted 9 lines
Quoted 2 lines

We might want to consider increasing the timeout. The following patch is an example to show what I mean.

Good idea. We should probably make this a parameter as well as up the timeout. Only the passthru command takes the timeout request as a parameter for some reason.

If you want to post a pull request on github, we can apply it from there.

Thanks.
I'll post a pull request. As you say though, having a timeout parameter would probably be even better.