Re: [PATCH v4 1/5] block: Fix bio IO priority setting

From: Christoph Hellwig
Date: Tue Dec 12 2023 - 08:13:32 EST


On Tue, Dec 12, 2023 at 07:11:46PM +0800, Hongyu Jin wrote:
> From: Hongyu Jin <hongyu.jin@xxxxxxxxxx>
>
> Move bio_set_ioprio() into submit_bio():
> 1. Only call bio_set_ioprio() once to set the priority of original bio,
> the bio that cloned and splited from original bio will auto inherit
> the priority of original bio in clone process.
>
> 2. The IO priority can be passed to module that implement
> struct gendisk::fops::submit_bio, help resolve some
> of the IO priority loss issues.

Can we reword this a bit. AFAICS what this primarily does it to ensure
the priority is set before dispatching to submit_bio based drivers or
blk-mq instead of just blk-mq, and the rest follows from that.

> +static void bio_set_ioprio(struct bio *bio)
> +{
> + /* Nobody set ioprio so far? Initialize it based on task's nice value */
> + if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
> + bio->bi_ioprio = get_current_ioprio();
> + blkcg_set_ioprio(bio);
> +}

I don't think we need the check here as anyone resubmitting a bio should
be using submit_bio_noact.