Re: [PATCH 2/2] block: remove the ioprio field from struct request

From: Sam Protsenko
Date: Tue Nov 26 2024 - 02:38:04 EST


On Tue, Nov 26, 2024 at 12:52 AM Christoph Hellwig <hch@xxxxxx> wrote:
>
> Hi Sam,
>
> please try the patch below:
>

I can confirm the patch fixes the issue on my side. Please add me to
Cc: if you're going to send the fix. And I'm always available to run
more tests on E850-96 board if you need it.

Thanks!

> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index acdc28756d9d..91b3789f710e 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -685,10 +685,9 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>
> prio = ioprio_class_to_prio[ioprio_class];
> per_prio = &dd->per_prio[prio];
> - if (!rq->elv.priv[0]) {
> + if (!rq->elv.priv[0])
> per_prio->stats.inserted++;
> - rq->elv.priv[0] = (void *)(uintptr_t)1;
> - }
> + rq->elv.priv[0] = per_prio;
>
> if (blk_mq_sched_try_insert_merge(q, rq, free))
> return;
> @@ -753,18 +752,14 @@ static void dd_prepare_request(struct request *rq)
> */
> static void dd_finish_request(struct request *rq)
> {
> - struct request_queue *q = rq->q;
> - struct deadline_data *dd = q->elevator->elevator_data;
> - const u8 ioprio_class = dd_rq_ioclass(rq);
> - const enum dd_prio prio = ioprio_class_to_prio[ioprio_class];
> - struct dd_per_prio *per_prio = &dd->per_prio[prio];
> + struct dd_per_prio *per_prio = rq->elv.priv[0];
>
> /*
> * The block layer core may call dd_finish_request() without having
> * called dd_insert_requests(). Skip requests that bypassed I/O
> * scheduling. See also blk_mq_request_bypass_insert().
> */
> - if (rq->elv.priv[0])
> + if (per_prio)
> atomic_inc(&per_prio->stats.completed);
> }
>