diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2021-08-11 12:37:02 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-08-18 07:23:15 -0600 |
commit | e70344c05995a190a56bbd1a23dc2218bcc8c924 (patch) | |
tree | 36a1c67d06e9d74264bc6289e09127dff37c4fa7 /include/linux/ioprio.h | |
parent | 202bc942c5cd4340d37b06c4e0b8b03f9925d818 (diff) | |
download | lwn-e70344c05995a190a56bbd1a23dc2218bcc8c924.tar.gz lwn-e70344c05995a190a56bbd1a23dc2218bcc8c924.zip |
block: fix default IO priority handling
The default IO priority is the best effort (BE) class with the
normal priority level IOPRIO_NORM (4). However, get_task_ioprio()
returns IOPRIO_CLASS_NONE/IOPRIO_NORM as the default priority and
get_current_ioprio() returns IOPRIO_CLASS_NONE/0. Let's be consistent
with the defined default and have both of these functions return the
default priority IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM) when
the user did not define another default IO priority for the task.
In include/uapi/linux/ioprio.h, introduce the IOPRIO_BE_NORM macro as
an alias to IOPRIO_NORM to clarify that this default level applies to
the BE priotity class. In include/linux/ioprio.h, define the macro
IOPRIO_DEFAULT as IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NORM)
and use this new macro when setting a priority to the default.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Link: https://lore.kernel.org/r/20210811033702.368488-7-damien.lemoal@wdc.com
[axboe: drop unnecessary lightnvm change]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/ioprio.h')
-rw-r--r-- | include/linux/ioprio.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 2ee3373684b1..3f53bc27a19b 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h @@ -9,6 +9,11 @@ #include <uapi/linux/ioprio.h> /* + * Default IO priority. + */ +#define IOPRIO_DEFAULT IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NORM) + +/* * Check that a priority value has a valid class. */ static inline bool ioprio_valid(unsigned short ioprio) @@ -51,7 +56,7 @@ static inline int get_current_ioprio(void) if (ioc) return ioc->ioprio; - return IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0); + return IOPRIO_DEFAULT; } /* |