1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_IOPRIO_H
3 #define _UAPI_LINUX_IOPRIO_H
6 * Gives us 8 prio classes with 13-bits of data for each class
8 #define IOPRIO_CLASS_SHIFT 13
9 #define IOPRIO_CLASS_MASK 0x07
10 #define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
12 #define IOPRIO_PRIO_CLASS(ioprio) \
13 (((ioprio) >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK)
14 #define IOPRIO_PRIO_DATA(ioprio) ((ioprio) & IOPRIO_PRIO_MASK)
15 #define IOPRIO_PRIO_VALUE(class, data) \
16 ((((class) & IOPRIO_CLASS_MASK) << IOPRIO_CLASS_SHIFT) | \
17 ((data) & IOPRIO_PRIO_MASK))
20 * These are the io priority groups as implemented by the BFQ and mq-deadline
21 * schedulers. RT is the realtime class, it always gets premium service. For
22 * ATA disks supporting NCQ IO priority, RT class IOs will be processed using
23 * high priority NCQ commands. BE is the best-effort scheduling class, the
24 * default for any process. IDLE is the idle scheduling class, it is only
25 * served when no one else is using the disk.
35 * The RT and BE priority classes both support up to 8 priority levels.
37 #define IOPRIO_NR_LEVELS 8
38 #define IOPRIO_BE_NR IOPRIO_NR_LEVELS
41 IOPRIO_WHO_PROCESS = 1,
47 * Fallback BE priority level.
50 #define IOPRIO_BE_NORM IOPRIO_NORM
52 #endif /* _UAPI_LINUX_IOPRIO_H */