| 1 | /* |
| 2 | * IO priority handling declarations and helper functions common to the |
| 3 | * libaio and io_uring engines. |
| 4 | */ |
| 5 | |
| 6 | #ifndef FIO_CMDPRIO_H |
| 7 | #define FIO_CMDPRIO_H |
| 8 | |
| 9 | #include "../fio.h" |
| 10 | |
| 11 | /* read and writes only, no trim */ |
| 12 | #define CMDPRIO_RWDIR_CNT 2 |
| 13 | |
| 14 | enum { |
| 15 | CMDPRIO_MODE_NONE, |
| 16 | CMDPRIO_MODE_PERC, |
| 17 | CMDPRIO_MODE_BSSPLIT, |
| 18 | }; |
| 19 | |
| 20 | struct cmdprio_options { |
| 21 | unsigned int percentage[CMDPRIO_RWDIR_CNT]; |
| 22 | unsigned int class[CMDPRIO_RWDIR_CNT]; |
| 23 | unsigned int level[CMDPRIO_RWDIR_CNT]; |
| 24 | char *bssplit_str; |
| 25 | }; |
| 26 | |
| 27 | struct cmdprio { |
| 28 | struct cmdprio_options *options; |
| 29 | unsigned int bssplit_nr[CMDPRIO_RWDIR_CNT]; |
| 30 | struct bssplit *bssplit[CMDPRIO_RWDIR_CNT]; |
| 31 | unsigned int mode; |
| 32 | }; |
| 33 | |
| 34 | bool fio_cmdprio_set_ioprio(struct thread_data *td, struct cmdprio *cmdprio, |
| 35 | struct io_u *io_u); |
| 36 | |
| 37 | void fio_cmdprio_cleanup(struct cmdprio *cmdprio); |
| 38 | |
| 39 | int fio_cmdprio_init(struct thread_data *td, struct cmdprio *cmdprio, |
| 40 | struct cmdprio_options *options); |
| 41 | |
| 42 | #endif |