From a9ee8ebeb1f304b76d7f9f49bd0f660d07447d6f Mon Sep 17 00:00:00 2001 From: Xiaoguang Wang Date: Tue, 17 Mar 2020 13:25:48 +0800 Subject: [PATCH] alinux: blk-mq: fix broken io_ticks & time_in_queue update fix #25369772 In blk-mq device, we observed a issue that though iops is low, but iostat shows a very high svctm & util value, which is counter-intuitive. The root cause is that blk_account_io_start() calls part_round_stats() before "rq->part = part" statement, so part_round_stats() will count an inflight request to the whole device, but not for the specific partition, then it'll update whole device's io_ticks and time_in_queue with a stale part->stamp. To fix this issue, if a request's part is NULL, we just don't count it as an inflight request to the whole device. Signed-off-by: Xiaoguang Wang Reviewed-by: Joseph Qi --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index a2e20b39a6ad..cf03ee7a17ae 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -106,7 +106,7 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, */ if (rq->part == mi->part) mi->inflight[0]++; - if (mi->part->partno) + if (rq->part && mi->part->partno) mi->inflight[1]++; } -- GitLab