Skip to content

Commit 53889bc

Browse files
committed
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 3b7cb74 commit 53889bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/linux/ioprio.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ static inline int __get_task_ioprio(struct task_struct *p)
5959
struct io_context *ioc = p->io_context;
6060
int prio;
6161

62+
if (!ioc)
63+
return IOPRIO_DEFAULT;
64+
6265
if (p != current)
6366
lockdep_assert_held(&p->alloc_lock);
64-
if (ioc)
65-
prio = ioc->ioprio;
66-
else
67-
prio = IOPRIO_DEFAULT;
6867

68+
prio = ioc->ioprio;
6969
if (IOPRIO_PRIO_CLASS(prio) == IOPRIO_CLASS_NONE)
7070
prio = IOPRIO_PRIO_VALUE(task_nice_ioclass(p),
7171
task_nice_ioprio(p));

0 commit comments

Comments
 (0)