Re: [PATCH] block: Fix default IO priority if there is no IO context

From: Damien Le Moal
Date: Thu Jul 31 2025 - 01:24:45 EST


On 7/31/25 1:49 PM, Guenter Roeck wrote:
> Upstream commit 53889bcaf536 ("block: make __get_task_ioprio() easier to
> read") changes the IO priority returned to the caller if no IO context
> is defined for the task. Prior to this commit, the returned IO priority
> was determined by task_nice_ioclass() and task_nice_ioprio(). Now it is
> always IOPRIO_DEFAULT, which translates to IOPRIO_CLASS_NONE with priority
> 0. However, task_nice_ioclass() returns IOPRIO_CLASS_IDLE, IOPRIO_CLASS_RT,
> or IOPRIO_CLASS_BE depending on the task scheduling policy, and
> task_nice_ioprio() returns a value determined by task_nice(). This causes
> regressions in test code checking the IO priority and class of IO
> operations on tasks with no IO context.
>
> Fix the problem by returning the IO priority calculated from
> task_nice_ioclass() and task_nice_ioprio() if no IO context is defined
> to match earlier behavior.
>
> Fixes: 53889bcaf536 ("block: make __get_task_ioprio() easier to read")
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> Cc: Bart Van Assche <bvanassche@xxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

Looks good to me.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>


--
Damien Le Moal
Western Digital Research