Re: [PATCH 1/3] block: introduce blk_queue_nr_active()

Bart Van Assche
2023-09-25T20:56:39Z

On 9/25/23 09:31, Ewan D. Milne wrote:
> +static inline unsigned int blk_mq_queue_nr_active(struct request_queue *q)
> +{
> + unsigned int nr_active = 0;
> + struct blk_mq_hw_ctx *hctx;
> + unsigned long i;
> +
> + queue_for_each_hw_ctx(q, hctx, i) {
> + if (unlikely(blk_mq_is_shared_tags(hctx->flags)))
> + return atomic_read(&q->nr_active_requests_shared_tags);
> + nr_active += atomic_read(&hctx->nr_active);
> + }
> + return nr_active;
> +}

The above function should never be called from any command submission
code path. Hence, I think it should be added in a .c file instead of
include/linux/blk-mq.h.

Thanks,

Bart.