mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
block: change ioprio_valid() to an inline function
Change the ioprio_valid() macro in include/usapi/linux/ioprio.h to an inline function declared on the kernel side in include/linux/ioprio.h. Also improve checks on the class value by checking the upper bound value. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Link: https://lore.kernel.org/r/20210811033702.368488-4-damien.lemoal@wdc.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
25bca50e52
commit
a553a835ca
2 changed files with 10 additions and 2 deletions
|
@ -8,6 +8,16 @@
|
|||
|
||||
#include <uapi/linux/ioprio.h>
|
||||
|
||||
/*
|
||||
* Check that a priority value has a valid class.
|
||||
*/
|
||||
static inline bool ioprio_valid(unsigned short ioprio)
|
||||
{
|
||||
unsigned short class = IOPRIO_PRIO_CLASS(ioprio);
|
||||
|
||||
return class > IOPRIO_CLASS_NONE && class <= IOPRIO_CLASS_IDLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* if process has set io priority explicitly, use that. if not, convert
|
||||
* the cpu scheduler nice value to an io priority
|
||||
|
|
|
@ -27,8 +27,6 @@ enum {
|
|||
IOPRIO_CLASS_IDLE,
|
||||
};
|
||||
|
||||
#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE)
|
||||
|
||||
/*
|
||||
* 8 best effort priority levels are supported
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue