block: also check RQF_STATS in blk_mq_need_time_stamp()
authorHou Tao <houtao1@huawei.com>
Tue, 21 May 2019 07:59:04 +0000 (15:59 +0800)
committerJens Axboe <axboe@kernel.dk>
Sun, 15 Sep 2019 22:02:10 +0000 (16:02 -0600)
In __blk_mq_end_request() if block stats needs update, we should
ensure now is valid instead of 0 even when iostat is disabled.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index d30fabb583fd568f29056b0b2330a49ee80a1452..214ed0739aa541fcb895ebaace148de1187bb8f6 100644 (file)
@@ -282,12 +282,12 @@ bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx)
 EXPORT_SYMBOL(blk_mq_can_queue);
 
 /*
- * Only need start/end time stamping if we have stats enabled, or using
- * an IO scheduler.
+ * Only need start/end time stamping if we have iostat or
+ * blk stats enabled, or using an IO scheduler.
  */
 static inline bool blk_mq_need_time_stamp(struct request *rq)
 {
-       return (rq->rq_flags & RQF_IO_STAT) || rq->q->elevator;
+       return (rq->rq_flags & (RQF_IO_STAT | RQF_STATS)) || rq->q->elevator;
 }
 
 static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,