From: "Pavel Begunkov (Silence)" <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@infradead.org>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pavel Begunkov <asml.silence@gmail.com>
Subject: [PATCH v2 1/2] blk-mq: Reuse callback in blk_mq_in_flight*()
Date: Mon, 30 Sep 2019 21:55:33 +0300 [thread overview]
Message-ID: <5ad78089aff5387a81e7655296ae326d4d96183d.1569868094.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1569868094.git.asml.silence@gmail.com>
From: Pavel Begunkov <asml.silence@gmail.com>
Reuse a more generic callback in both blk_mq_in_flight() and
blk_mq_in_flight_rw().
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
block/blk-mq.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c4e5070c2ecd..3359a0b6c398 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -102,11 +102,8 @@ static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx,
{
struct mq_inflight *mi = priv;
- /*
- * index[0] counts the specific partition that was asked for.
- */
if (rq->part == mi->part)
- mi->inflight[0]++;
+ mi->inflight[rq_data_dir(rq)]++;
return true;
}
@@ -119,19 +116,7 @@ unsigned int blk_mq_in_flight(struct request_queue *q, struct hd_struct *part)
inflight[0] = inflight[1] = 0;
blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi);
- return inflight[0];
-}
-
-static bool blk_mq_check_inflight_rw(struct blk_mq_hw_ctx *hctx,
- struct request *rq, void *priv,
- bool reserved)
-{
- struct mq_inflight *mi = priv;
-
- if (rq->part == mi->part)
- mi->inflight[rq_data_dir(rq)]++;
-
- return true;
+ return inflight[0] + inflight[1];
}
void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part,
@@ -140,7 +125,7 @@ void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part,
struct mq_inflight mi = { .part = part, .inflight = inflight, };
inflight[0] = inflight[1] = 0;
- blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight_rw, &mi);
+ blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi);
}
void blk_freeze_queue_start(struct request_queue *q)
--
2.23.0
next prev parent reply other threads:[~2019-09-30 20:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 8:27 [PATCH 1/1] blk-mq: reuse code in blk_mq_check_inflight*() Pavel Begunkov (Silence)
2019-09-30 8:33 ` Christoph Hellwig
2019-09-30 9:20 ` Pavel Begunkov
2019-09-30 18:55 ` [PATCH v2 0/2] Simplify blk_mq_in_flight* Pavel Begunkov (Silence)
2019-09-30 18:55 ` Pavel Begunkov (Silence) [this message]
2019-09-30 18:55 ` [PATCH v2 2/2] blk-mq: Embed counters into struct mq_inflight Pavel Begunkov (Silence)
2019-10-02 3:40 ` [PATCH v2 0/2] Simplify blk_mq_in_flight* 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=5ad78089aff5387a81e7655296ae326d4d96183d.1569868094.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).