Commit | Line | Data |
---|---|---|
e9f6567a DLM |
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 | ||
a5af2a8b NC |
11 | /* read and writes only, no trim */ |
12 | #define CMDPRIO_RWDIR_CNT 2 | |
13 | ||
97f2d484 NC |
14 | enum { |
15 | CMDPRIO_MODE_NONE, | |
16 | CMDPRIO_MODE_PERC, | |
17 | CMDPRIO_MODE_BSSPLIT, | |
18 | }; | |
19 | ||
f0547200 NC |
20 | struct cmdprio_prio { |
21 | int32_t prio; | |
22 | uint32_t perc; | |
23 | uint16_t clat_prio_index; | |
24 | }; | |
25 | ||
26 | struct cmdprio_bsprio { | |
27 | uint64_t bs; | |
28 | uint32_t tot_perc; | |
29 | unsigned int nr_prios; | |
30 | struct cmdprio_prio *prios; | |
31 | }; | |
32 | ||
33 | struct cmdprio_bsprio_desc { | |
34 | struct cmdprio_bsprio *bsprios; | |
35 | unsigned int nr_bsprios; | |
36 | }; | |
37 | ||
d6cbeab4 | 38 | struct cmdprio_options { |
a5af2a8b NC |
39 | unsigned int percentage[CMDPRIO_RWDIR_CNT]; |
40 | unsigned int class[CMDPRIO_RWDIR_CNT]; | |
41 | unsigned int level[CMDPRIO_RWDIR_CNT]; | |
d6cbeab4 NC |
42 | char *bssplit_str; |
43 | }; | |
44 | ||
45 | struct cmdprio { | |
46 | struct cmdprio_options *options; | |
f0547200 NC |
47 | struct cmdprio_prio perc_entry[CMDPRIO_RWDIR_CNT]; |
48 | struct cmdprio_bsprio_desc bsprio_desc[CMDPRIO_RWDIR_CNT]; | |
97f2d484 | 49 | unsigned int mode; |
e9f6567a DLM |
50 | }; |
51 | ||
127715b6 NC |
52 | bool fio_cmdprio_set_ioprio(struct thread_data *td, struct cmdprio *cmdprio, |
53 | struct io_u *io_u); | |
a48f0cc7 | 54 | |
d6cbeab4 NC |
55 | void fio_cmdprio_cleanup(struct cmdprio *cmdprio); |
56 | ||
57 | int fio_cmdprio_init(struct thread_data *td, struct cmdprio *cmdprio, | |
58 | struct cmdprio_options *options); | |
e9f6567a DLM |
59 | |
60 | #endif |