Skip to content

Commit

Permalink
block: clarify blk_add_timer() use case for blk-mq
Browse files Browse the repository at this point in the history
Just a comment update on not needing queue_lock, and that we aren't
really adding the request to a timeout list for !mq.

Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Nov 24, 2015
1 parent bd5cece commit 3b627a3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions block/blk-timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ unsigned long blk_rq_timeout(unsigned long timeout)
* Notes:
* Each request has its own timer, and as it is added to the queue, we
* set up the timer. When the request completes, we cancel the timer.
* Queue lock must be held for the non-mq case, mq case doesn't care.
*/
void blk_add_timer(struct request *req)
{
Expand All @@ -209,6 +210,11 @@ void blk_add_timer(struct request *req)
req->timeout = q->rq_timeout;

req->deadline = jiffies + req->timeout;

/*
* Only the non-mq case needs to add the request to a protected list.
* For the mq case we simply scan the tag map.
*/
if (!q->mq_ops)
list_add_tail(&req->timeout_list, &req->q->timeout_list);

Expand Down

0 comments on commit 3b627a3

Please sign in to comment.