Commit a2e80f6f authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

blk-mq: Embed counters into struct mq_inflight

Store inflight counters immediately in struct mq_inflight.
That's type-safer and removes extra indirection.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent bb4e6b14
...@@ -93,7 +93,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx, ...@@ -93,7 +93,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx,
struct mq_inflight { struct mq_inflight {
struct hd_struct *part; struct hd_struct *part;
unsigned int *inflight; unsigned int inflight[2];
}; };
static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx,
...@@ -110,22 +110,21 @@ static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, ...@@ -110,22 +110,21 @@ static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx,
unsigned int blk_mq_in_flight(struct request_queue *q, struct hd_struct *part) unsigned int blk_mq_in_flight(struct request_queue *q, struct hd_struct *part)
{ {
unsigned inflight[2]; struct mq_inflight mi = { .part = 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, &mi); blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi);
return inflight[0] + inflight[1]; return mi.inflight[0] + mi.inflight[1];
} }
void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part, void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part,
unsigned int inflight[2]) unsigned int inflight[2])
{ {
struct mq_inflight mi = { .part = part, .inflight = inflight, }; struct mq_inflight mi = { .part = part };
inflight[0] = inflight[1] = 0;
blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi); blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi);
inflight[0] = mi.inflight[0];
inflight[1] = mi.inflight[1];
} }
void blk_freeze_queue_start(struct request_queue *q) void blk_freeze_queue_start(struct request_queue *q)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment