From c22d9d8a60646a1521ae12a2176f58da19afa186 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 23 May 2014 14:14:57 -0600 Subject: blk-mq: allow setting of per-request timeouts Currently blk-mq uses the queue timeout for all requests. But for some commands, drivers may want to set a specific timeout for special requests. Allow this to be passed in through request->timeout, and use it if set. Signed-off-by: Jens Axboe --- block/blk-mq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'block') diff --git a/block/blk-mq.c b/block/blk-mq.c index 54e78863c083..9bc075335d06 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -454,9 +454,13 @@ static void blk_mq_start_request(struct request *rq, bool last) /* * Just mark start time and set the started bit. Due to memory * ordering, we know we'll see the correct deadline as long as - * REQ_ATOMIC_STARTED is seen. + * REQ_ATOMIC_STARTED is seen. Use the default queue timeout, + * unless one has been set in the request. */ - rq->deadline = jiffies + q->rq_timeout; + if (!rq->timeout) + rq->deadline = jiffies + q->rq_timeout; + else + rq->deadline = jiffies + rq->timeout; /* * Mark us as started and clear complete. Complete might have been -- cgit v1.2.2