Skip to content

Commit

Permalink
block: Return effective IO priority from get_current_ioprio()
Browse files Browse the repository at this point in the history
get_current_ioprio() is used to initialize IO priority of various
requests. As such it should be returning the effective IO priority of
the task (i.e., reflecting the fact that unset IO priority should get
set based on task's CPU priority) so that the conversion is concentrated
in one place.

Reviewed-by: Damien Le Moal <[email protected]>
Tested-by: Damien Le Moal <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
jankara authored and axboe committed Jun 27, 2022
1 parent e589f46 commit f7eda40
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/linux/ioprio.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,17 @@ static inline int task_nice_ioclass(struct task_struct *task)
static inline int get_current_ioprio(void)
{
struct io_context *ioc = current->io_context;
int prio;

if (ioc)
return ioc->ioprio;
return IOPRIO_DEFAULT;
prio = ioc->ioprio;
else
prio = IOPRIO_DEFAULT;

if (IOPRIO_PRIO_CLASS(prio) == IOPRIO_CLASS_NONE)
prio = IOPRIO_PRIO_VALUE(task_nice_ioclass(current),
task_nice_ioprio(current));
return prio;
}

/*
Expand Down

0 comments on commit f7eda40

Please sign in to comment.