aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-05-23 16:14:57 -0400
committerJens Axboe <axboe@fb.com>2014-05-23 16:14:57 -0400
commitc22d9d8a60646a1521ae12a2176f58da19afa186 (patch)
treea775af0fa69f0eb8f81ce258fbfbab52d6ae86e4 /block
parentedf866b3805c5651bf7d035b72dc0190cb6ff4a7 (diff)
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 <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c8
1 files changed, 6 insertions, 2 deletions
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)
454 /* 454 /*
455 * Just mark start time and set the started bit. Due to memory 455 * Just mark start time and set the started bit. Due to memory
456 * ordering, we know we'll see the correct deadline as long as 456 * ordering, we know we'll see the correct deadline as long as
457 * REQ_ATOMIC_STARTED is seen. 457 * REQ_ATOMIC_STARTED is seen. Use the default queue timeout,
458 * unless one has been set in the request.
458 */ 459 */
459 rq->deadline = jiffies + q->rq_timeout; 460 if (!rq->timeout)
461 rq->deadline = jiffies + q->rq_timeout;
462 else
463 rq->deadline = jiffies + rq->timeout;
460 464
461 /* 465 /*
462 * Mark us as started and clear complete. Complete might have been 466 * Mark us as started and clear complete. Complete might have been