blk-mq: count allocated but not started requests in iostats inflight

In the legacy block case, we increment the counter right after we
allocate the request, not when the driver handles it. In both the legacy
and blk-mq cases, part_inc_in_flight() is called from
blk_account_io_start() right after we've allocated the request. blk-mq
only considers requests started requests as inflight, but this is
inconsistent with the legacy definition and the intention in the code.
This removes the started condition and instead counts all allocated
requests.

Fixes: f299b7c7a9 ("blk-mq: provide internal in-flight variant")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Omar Sandoval 2018-04-26 00:21:58 -07:00 committed by Jens Axboe
parent 69bfd470f4
commit 6131837b1d
1 changed files with 9 additions and 12 deletions

View File

@ -95,18 +95,15 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx,
{ {
struct mq_inflight *mi = priv; struct mq_inflight *mi = priv;
if (blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) { /*
/* * index[0] counts the specific partition that was asked for. index[1]
* index[0] counts the specific partition that was asked * counts the ones that are active on the whole device, so increment
* for. index[1] counts the ones that are active on the * that if mi->part is indeed a partition, and not a whole device.
* whole device, so increment that if mi->part is indeed */
* a partition, and not a whole device. if (rq->part == mi->part)
*/ mi->inflight[0]++;
if (rq->part == mi->part) if (mi->part->partno)
mi->inflight[0]++; mi->inflight[1]++;
if (mi->part->partno)
mi->inflight[1]++;
}
} }
void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part, void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part,