Commit 3b627a3f authored by Jens Axboe's avatar Jens Axboe
Browse files

block: clarify blk_add_timer() use case for blk-mq



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: default avatarJens Axboe <axboe@fb.com>
parent bd5cecea
...@@ -186,6 +186,7 @@ unsigned long blk_rq_timeout(unsigned long timeout) ...@@ -186,6 +186,7 @@ unsigned long blk_rq_timeout(unsigned long timeout)
* Notes: * Notes:
* Each request has its own timer, and as it is added to the queue, we * 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. * 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) void blk_add_timer(struct request *req)
{ {
...@@ -209,6 +210,11 @@ void blk_add_timer(struct request *req) ...@@ -209,6 +210,11 @@ void blk_add_timer(struct request *req)
req->timeout = q->rq_timeout; req->timeout = q->rq_timeout;
req->deadline = jiffies + req->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) if (!q->mq_ops)
list_add_tail(&req->timeout_list, &req->q->timeout_list); list_add_tail(&req->timeout_list, &req->q->timeout_list);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment