os: introduce ioprio_value() helper
authorDamien Le Moal <damien.lemoal@wdc.com>
Fri, 3 Sep 2021 15:20:23 +0000 (15:20 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Sep 2021 16:12:13 +0000 (10:12 -0600)
commit8d6e8d99c8e080a20c025cf16f98097b630c072e
tree74a4b51fff3b3a456701b0e329f37ba8c2234837
parent04cd8b6fd11cfde50a433ff41c3dc8e9c1032139
os: introduce ioprio_value() helper

Introduce the ioprio_value() helper function to calculate a priority
value based on a priority class and priority level. For Linux and
Android, this is defined as an integer equal to the priority class
shifted left by 13 bits and or-ed with the priority level. For
Dragonfly, ioprio_value() simply returns the priority level as there
is no concept of priority class.

Use this new helper in the io_uring and libaio engines to set IO
priority when the cmdprio_percentage option is used.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/io_uring.c
engines/libaio.c
os/os-android.h
os/os-dragonfly.h
os/os-linux.h
os/os.h