-
Notifications
You must be signed in to change notification settings - Fork 0
/
io_ddir.h
76 lines (63 loc) · 1.92 KB
/
io_ddir.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef FIO_DDIR_H
#define FIO_DDIR_H
enum fio_ddir {
DDIR_READ = 0,
DDIR_WRITE = 1,
DDIR_TRIM = 2,
DDIR_SYNC = 3,
DDIR_DATASYNC,
DDIR_SYNC_FILE_RANGE,
DDIR_WAIT,
DDIR_LAST,
DDIR_INVAL = -1,
DDIR_RWDIR_CNT = 3,
DDIR_RWDIR_SYNC_CNT = 4,
};
static inline const char *io_ddir_name(enum fio_ddir ddir)
{
static const char *name[] = { "read", "write", "trim", "sync",
"datasync", "sync_file_range",
"wait", };
if (ddir < DDIR_LAST)
return name[ddir];
return "invalid";
}
enum td_ddir {
TD_DDIR_READ = 1 << 0,
TD_DDIR_WRITE = 1 << 1,
TD_DDIR_RAND = 1 << 2,
TD_DDIR_TRIM = 1 << 3,
TD_DDIR_RW = TD_DDIR_READ | TD_DDIR_WRITE,
TD_DDIR_RANDREAD = TD_DDIR_READ | TD_DDIR_RAND,
TD_DDIR_RANDWRITE = TD_DDIR_WRITE | TD_DDIR_RAND,
TD_DDIR_RANDRW = TD_DDIR_RW | TD_DDIR_RAND,
TD_DDIR_RANDTRIM = TD_DDIR_TRIM | TD_DDIR_RAND,
TD_DDIR_TRIMWRITE = TD_DDIR_TRIM | TD_DDIR_WRITE,
};
#define td_read(td) ((td)->o.td_ddir & TD_DDIR_READ)
#define td_write(td) ((td)->o.td_ddir & TD_DDIR_WRITE)
#define td_trim(td) ((td)->o.td_ddir & TD_DDIR_TRIM)
#define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)
#define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND)
#define file_randommap(td, f) (!(td)->o.norandommap && fio_file_axmap((f)))
#define td_trimwrite(td) (((td)->o.td_ddir & TD_DDIR_TRIMWRITE) \
== TD_DDIR_TRIMWRITE)
static inline int ddir_sync(enum fio_ddir ddir)
{
return ddir == DDIR_SYNC || ddir == DDIR_DATASYNC ||
ddir == DDIR_SYNC_FILE_RANGE;
}
static inline int ddir_rw(enum fio_ddir ddir)
{
return ddir == DDIR_READ || ddir == DDIR_WRITE || ddir == DDIR_TRIM;
}
static inline const char *ddir_str(enum td_ddir ddir)
{
static const char *__str[] = { NULL, "read", "write", "rw", "rand",
"randread", "randwrite", "randrw",
"trim", NULL, "trimwrite", NULL, "randtrim" };
return __str[ddir];
}
#define ddir_rw_sum(arr) \
((arr)[DDIR_READ] + (arr)[DDIR_WRITE] + (arr)[DDIR_TRIM])
#endif