summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-06-09 17:36:53 +0200
committerJens Axboe <axboe@fb.com>2014-06-09 17:36:53 +0200
commit3ee3237239583a6555db4f297d00eebdbb6d76ad (patch)
treefd1ccfd86dc6e9687e3bf5e0f8821786d5eb0806 /block/blk-mq.c
parentblock: blk-exec.c: Cleaning up local variable address returnd (diff)
downloadlinux-3ee3237239583a6555db4f297d00eebdbb6d76ad.tar.xz
linux-3ee3237239583a6555db4f297d00eebdbb6d76ad.zip
blk-mq: always initialize request->start_time
The blk-mq core only initializes this if io stats are enabled, since blk-mq only reads the field in that case. But drivers could potentially use it internally, so ensure that we always set it to the current time when the request is allocated. Reported-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index fafea52281ac..a5ea37d7e820 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -185,6 +185,7 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
RB_CLEAR_NODE(&rq->rb_node);
rq->rq_disk = NULL;
rq->part = NULL;
+ rq->start_time = jiffies;
#ifdef CONFIG_BLK_CGROUP
rq->rl = NULL;
set_start_time_ns(rq);
@@ -1104,10 +1105,8 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio)
{
init_request_from_bio(rq, bio);
- if (blk_do_io_stat(rq)) {
- rq->start_time = jiffies;
+ if (blk_do_io_stat(rq))
blk_account_io_start(rq, 1);
- }
}
static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx,