From: Jens Axboe Date: Sun, 6 Oct 2024 21:11:24 +0000 (-0600) Subject: block: set issue time stamp based on queue state X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=148e6968f6789e42a318ce7d11ea506d75567c1d;p=users%2Fhch%2Fmisc.git block: set issue time stamp based on queue state A previous commit moved RQF_IO_STAT into blk_account_io_done(), where it's being set rather than at allocation time. Unfortunately we do check for that flag in blk_mq_rq_time_init(), and hence setting the start_time_ns wasn't being done. This lead to unwieldy inflight IO counts and times, as IO completion accounting would a 0 value rather than the issue time for it's subtraction math. Fix this by switching the blk_mq_rq_time_init() check to use the queue state rather than the request state. Fixes: b8f762400ae8 ("block: move iostat check into blk_acount_io_start()") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202410062110.512391df-oliver.sang@intel.com Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq.c b/block/blk-mq.c index b249514c2d63..9a3a9a370618 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -331,7 +331,7 @@ EXPORT_SYMBOL(blk_rq_init); /* Set start and alloc time when the allocated request is actually used */ static inline void blk_mq_rq_time_init(struct request *rq, u64 alloc_time_ns) { - if (blk_mq_need_time_stamp(rq)) + if (blk_queue_io_stat(rq->q)) rq->start_time_ns = blk_time_get_ns(); else rq->start_time_ns = 0;