btrace2fio: cleanups and inflight hashing
[fio.git] / io_ddir.h
... / ...
CommitLineData
1#ifndef FIO_DDIR_H
2#define FIO_DDIR_H
3
4enum fio_ddir {
5 DDIR_READ = 0,
6 DDIR_WRITE = 1,
7 DDIR_TRIM = 2,
8 DDIR_RWDIR_CNT = 3,
9 DDIR_SYNC = 3,
10 DDIR_DATASYNC,
11 DDIR_SYNC_FILE_RANGE,
12 DDIR_WAIT,
13 DDIR_INVAL = -1,
14};
15
16enum td_ddir {
17 TD_DDIR_READ = 1 << 0,
18 TD_DDIR_WRITE = 1 << 1,
19 TD_DDIR_RAND = 1 << 2,
20 TD_DDIR_TRIM = 1 << 3,
21 TD_DDIR_RW = TD_DDIR_READ | TD_DDIR_WRITE,
22 TD_DDIR_RANDREAD = TD_DDIR_READ | TD_DDIR_RAND,
23 TD_DDIR_RANDWRITE = TD_DDIR_WRITE | TD_DDIR_RAND,
24 TD_DDIR_RANDRW = TD_DDIR_RW | TD_DDIR_RAND,
25 TD_DDIR_RANDTRIM = TD_DDIR_TRIM | TD_DDIR_RAND,
26};
27
28#define td_read(td) ((td)->o.td_ddir & TD_DDIR_READ)
29#define td_write(td) ((td)->o.td_ddir & TD_DDIR_WRITE)
30#define td_trim(td) ((td)->o.td_ddir & TD_DDIR_TRIM)
31#define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)
32#define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND)
33#define file_randommap(td, f) (!(td)->o.norandommap && (f)->io_axmap)
34
35static inline int ddir_sync(enum fio_ddir ddir)
36{
37 return ddir == DDIR_SYNC || ddir == DDIR_DATASYNC ||
38 ddir == DDIR_SYNC_FILE_RANGE;
39}
40
41static inline int ddir_rw(enum fio_ddir ddir)
42{
43 return ddir == DDIR_READ || ddir == DDIR_WRITE || ddir == DDIR_TRIM;
44}
45
46static inline const char *ddir_str(enum td_ddir ddir)
47{
48 const char *ddir_str[] = { NULL, "read", "write", "rw", NULL,
49 "randread", "randwrite", "randrw",
50 "trim", NULL, NULL, NULL, "randtrim" };
51
52 return ddir_str[ddir];
53}
54
55#define ddir_trim(ddir) ((ddir) == DDIR_TRIM)
56
57#define ddir_rw_sum(arr) \
58 ((arr)[DDIR_READ] + (arr)[DDIR_WRITE] + (arr)[DDIR_TRIM])
59
60#endif