Message ID | 20231205053213.522772-3-bvanassche@acm.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Improve mq-deadline I/O priority support | expand |
On 12/5/23 14:32, Bart Van Assche wrote: > Prepare for disabling I/O prioritization in certain cases. > > Cc: Damien Le Moal <dlemoal@kernel.org> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> > --- > block/mq-deadline.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/block/mq-deadline.c b/block/mq-deadline.c > index e558f3660357..fe5da2ade953 100644 > --- a/block/mq-deadline.c > +++ b/block/mq-deadline.c > @@ -128,6 +128,11 @@ static u8 dd_rq_ioclass(struct request *rq) > return IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); > } > > +static u8 dd_bio_ioclass(struct bio *bio) > +{ > + return IOPRIO_PRIO_CLASS(bio->bi_ioprio); > +} > + > /* > * get the request before `rq' in sector-sorted order > */ > @@ -744,7 +749,7 @@ static int dd_request_merge(struct request_queue *q, struct request **rq, > struct bio *bio) > { > struct deadline_data *dd = q->elevator->elevator_data; > - const u8 ioprio_class = IOPRIO_PRIO_CLASS(bio->bi_ioprio); > + const u8 ioprio_class = dd_bio_ioclass(bio); > const enum dd_prio prio = ioprio_class_to_prio[ioprio_class]; > struct dd_per_prio *per_prio = &dd->per_prio[prio]; > sector_t sector = bio_end_sector(bio);
On Mon, Dec 04, 2023 at 09:32:12PM -0800, Bart Van Assche wrote:
> Prepare for disabling I/O prioritization in certain cases.
On it's own this looks pretty useless to be honest, an with just a
single caller it can't really make future patches significantly
simpler either.
On 12/11/23 08:55, Christoph Hellwig wrote: > On Mon, Dec 04, 2023 at 09:32:12PM -0800, Bart Van Assche wrote: >> Prepare for disabling I/O prioritization in certain cases. > > On it's own this looks pretty useless to be honest, an with just a > single caller it can't really make future patches significantly > simpler either. This patch helps because a helper function can have multiple return statements. The alternative without helper function is using a less readable ternary conditional. Bart.
diff --git a/block/mq-deadline.c b/block/mq-deadline.c index e558f3660357..fe5da2ade953 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -128,6 +128,11 @@ static u8 dd_rq_ioclass(struct request *rq) return IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); } +static u8 dd_bio_ioclass(struct bio *bio) +{ + return IOPRIO_PRIO_CLASS(bio->bi_ioprio); +} + /* * get the request before `rq' in sector-sorted order */ @@ -744,7 +749,7 @@ static int dd_request_merge(struct request_queue *q, struct request **rq, struct bio *bio) { struct deadline_data *dd = q->elevator->elevator_data; - const u8 ioprio_class = IOPRIO_PRIO_CLASS(bio->bi_ioprio); + const u8 ioprio_class = dd_bio_ioclass(bio); const enum dd_prio prio = ioprio_class_to_prio[ioprio_class]; struct dd_per_prio *per_prio = &dd->per_prio[prio]; sector_t sector = bio_end_sector(bio);
Prepare for disabling I/O prioritization in certain cases. Cc: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/mq-deadline.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)