diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2019-09-30 20:55:34 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-10-07 16:31:59 +0200 |
commit | a2e80f6f044526e00a788aa8e1ed72b1911f4534 (patch) | |
tree | df015a743e136cec6d161e1c727bdee4606e0e4b /block | |
parent | blk-mq: Reuse callback in blk_mq_in_flight*() (diff) | |
download | linux-a2e80f6f044526e00a788aa8e1ed72b1911f4534.tar.xz linux-a2e80f6f044526e00a788aa8e1ed72b1911f4534.zip |
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: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 19560a16a774..8538dc415499 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -93,7 +93,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx, struct mq_inflight { struct hd_struct *part; - unsigned int *inflight; + unsigned int inflight[2]; }; 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 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); - 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, 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); + inflight[0] = mi.inflight[0]; + inflight[1] = mi.inflight[1]; } void blk_freeze_queue_start(struct request_queue *q) |