mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-31 22:23:05 +00:00
block: make __get_task_ioprio() easier to read
We don't need to do any gymnastics if we don't have an io_context assigned at all, so just return early with our default priority. Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
3b7cb74547
commit
53889bcaf5
@ -59,13 +59,13 @@ static inline int __get_task_ioprio(struct task_struct *p)
|
|||||||
struct io_context *ioc = p->io_context;
|
struct io_context *ioc = p->io_context;
|
||||||
int prio;
|
int prio;
|
||||||
|
|
||||||
|
if (!ioc)
|
||||||
|
return IOPRIO_DEFAULT;
|
||||||
|
|
||||||
if (p != current)
|
if (p != current)
|
||||||
lockdep_assert_held(&p->alloc_lock);
|
lockdep_assert_held(&p->alloc_lock);
|
||||||
if (ioc)
|
|
||||||
prio = ioc->ioprio;
|
|
||||||
else
|
|
||||||
prio = IOPRIO_DEFAULT;
|
|
||||||
|
|
||||||
|
prio = ioc->ioprio;
|
||||||
if (IOPRIO_PRIO_CLASS(prio) == IOPRIO_CLASS_NONE)
|
if (IOPRIO_PRIO_CLASS(prio) == IOPRIO_CLASS_NONE)
|
||||||
prio = IOPRIO_PRIO_VALUE(task_nice_ioclass(p),
|
prio = IOPRIO_PRIO_VALUE(task_nice_ioclass(p),
|
||||||
task_nice_ioprio(p));
|
task_nice_ioprio(p));
|
||||||
|
Loading…
Reference in New Issue
Block a user