Skip to content

Commit

Permalink
blk-mq: allow setting of per-request timeouts
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed May 23, 2014
1 parent edf866b commit c22d9d8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c22d9d8

Please sign in to comment.