Commit 2b8393b43ec672bb263009cd74c056ab01d6ac17

Authored by Ming Lei
Committed by Jens Axboe
1 parent 3ee3237239

blk-mq: add timer in blk_mq_start_request

This way will become consistent with non-mq case, also
avoid to update rq->deadline twice for mq.

The comment said: "We do this early, to ensure we are on
the right CPU.", but no percpu stuff is used in blk_add_timer(),
so it isn't necessary. Even when inserting from plug list, there
is no such guarantee at all.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>

Showing 1 changed file with 1 additions and 16 deletions Side-by-side Diff

... ... @@ -411,16 +411,7 @@
411 411 if (unlikely(blk_bidi_rq(rq)))
412 412 rq->next_rq->resid_len = blk_rq_bytes(rq->next_rq);
413 413  
414   - /*
415   - * Just mark start time and set the started bit. Due to memory
416   - * ordering, we know we'll see the correct deadline as long as
417   - * REQ_ATOMIC_STARTED is seen. Use the default queue timeout,
418   - * unless one has been set in the request.
419   - */
420   - if (!rq->timeout)
421   - rq->deadline = jiffies + q->rq_timeout;
422   - else
423   - rq->deadline = jiffies + rq->timeout;
  414 + blk_add_timer(rq);
424 415  
425 416 /*
426 417 * Mark us as started and clear complete. Complete might have been
... ... @@ -972,11 +963,6 @@
972 963 list_add_tail(&rq->queuelist, &ctx->rq_list);
973 964  
974 965 blk_mq_hctx_mark_pending(hctx, ctx);
975   -
976   - /*
977   - * We do this early, to ensure we are on the right CPU.
978   - */
979   - blk_add_timer(rq);
980 966 }
981 967  
982 968 void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue,
... ... @@ -1219,7 +1205,6 @@
1219 1205  
1220 1206 blk_mq_bio_to_request(rq, bio);
1221 1207 blk_mq_start_request(rq, true);
1222   - blk_add_timer(rq);
1223 1208  
1224 1209 /*
1225 1210 * For OK queue, we are done. For error, kill it. Any other