linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NVMe: Use user defined admin ioctl timeout
@ 2013-05-07 20:17 Keith Busch
  2013-05-07 21:05 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2013-05-07 20:17 UTC (permalink / raw)


Use the user ioctl command timeout value if it is specified, and use
the default admin command timeout if one is not given.

Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 drivers/block/nvme-core.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index a232dfc..3ff3ba0 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1362,6 +1362,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev,
 	struct nvme_command c;
 	int status, length;
 	struct nvme_iod *uninitialized_var(iod);
+	unsigned timeout;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -1391,10 +1392,13 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev,
 								GFP_KERNEL);
 	}
 
+	timeout = cmd.timeout_ms ? DIV_ROUND_UP(cmd.timeout_ms * HZ, 1000):
+								ADMIN_TIMEOUT;
 	if (length != cmd.data_len)
 		status = -ENOMEM;
 	else
-		status = nvme_submit_admin_cmd(dev, &c, &cmd.result);
+		status = nvme_submit_sync_cmd(dev->queues[0], &c, &cmd.result,
+								timeout);
 
 	if (cmd.data_len) {
 		nvme_unmap_user_pages(dev, cmd.opcode & 1, iod);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] NVMe: Use user defined admin ioctl timeout
  2013-05-07 20:17 [PATCH] NVMe: Use user defined admin ioctl timeout Keith Busch
@ 2013-05-07 21:05 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2013-05-07 21:05 UTC (permalink / raw)


On Tue, May 07, 2013@02:17:54PM -0600, Keith Busch wrote:
> +	timeout = cmd.timeout_ms ? DIV_ROUND_UP(cmd.timeout_ms * HZ, 1000):

We have a fine function called msecs_to_jiffies(), which I'd prefer you to
use instead :-)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-07 21:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07 20:17 [PATCH] NVMe: Use user defined admin ioctl timeout Keith Busch
2013-05-07 21:05 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).