mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: iamhswang@gmail.com
To: axboe@kernel.dk
Cc: zhangwensheng5@huawei.com, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, Haisu Wang <haisuwang@tencent.com>,
	samuelliao <samuelliao@tencent.com>
Subject: [PATCH] blk-mq: do not update io_ticks with passthrough requests
Date: Mon, 30 May 2022 14:40:59 +0800	[thread overview]
Message-ID: <20220530064059.1120058-1-haisuwang@tencent.com> (raw)

From: Haisu Wang <haisuwang@tencent.com>

Flush or passthrough requests are not accounted as normal IO in completion.
To reflect iostat for slow IO, io_ticks is updated when stat show called
based on inflight numbers.
It may cause inconsistent io_ticks calculation result.

So do not account non-passthrough request when check inflight.

Fixes: 86d7331299fd ("block: update io_ticks when io hang")
Signed-off-by: Haisu Wang <haisuwang@tencent.com>
Reviewed-by: samuelliao <samuelliao@tencent.com>
---
 block/blk-mq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index ae116b755648..3912cae42da3 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -133,7 +133,8 @@ static bool blk_mq_check_inflight(struct request *rq, void *priv,
 {
 	struct mq_inflight *mi = priv;
 
-	if ((!mi->part->bd_partno || rq->part == mi->part) &&
+	if (rq->part && blk_do_io_stat(rq) &&
+	    (!mi->part->bd_partno || rq->part == mi->part) &&
 	    blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT)
 		mi->inflight[rq_data_dir(rq)]++;
 
-- 
2.27.0


             reply	other threads:[~2022-05-30  6:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  6:40 iamhswang [this message]
2022-05-30 13:08 ` Christoph Hellwig
2022-05-30 13:13 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220530064059.1120058-1-haisuwang@tencent.com \
    --to=iamhswang@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=haisuwang@tencent.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuelliao@tencent.com \
    --cc=zhangwensheng5@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®