blob: b234256243db00b1ea608f07173709618c47d5b9 [file] [log] [blame]
Jens Axboed6aed792009-06-03 08:41:15 +02001#ifndef FIO_DDIR_H
2#define FIO_DDIR_H
3
4enum fio_ddir {
5 DDIR_READ = 0,
6 DDIR_WRITE,
7 DDIR_SYNC,
Jens Axboe5f9099e2009-06-16 22:40:26 +02008 DDIR_DATASYNC,
Jens Axboe44f29692010-03-09 20:09:44 +01009 DDIR_SYNC_FILE_RANGE,
Glen Ogilvie457bf392009-11-03 21:52:36 +010010 DDIR_WAIT,
Jens Axboea5f30272010-07-19 16:19:55 -060011 DDIR_TRIM,
Jens Axboed6aed792009-06-03 08:41:15 +020012 DDIR_INVAL = -1,
13};
14
15enum td_ddir {
16 TD_DDIR_READ = 1 << 0,
17 TD_DDIR_WRITE = 1 << 1,
18 TD_DDIR_RAND = 1 << 2,
19 TD_DDIR_RW = TD_DDIR_READ | TD_DDIR_WRITE,
20 TD_DDIR_RANDREAD = TD_DDIR_READ | TD_DDIR_RAND,
21 TD_DDIR_RANDWRITE = TD_DDIR_WRITE | TD_DDIR_RAND,
22 TD_DDIR_RANDRW = TD_DDIR_RW | TD_DDIR_RAND,
23};
24
Jens Axboe29c8e862009-06-05 22:10:51 +020025#define td_read(td) ((td)->o.td_ddir & TD_DDIR_READ)
26#define td_write(td) ((td)->o.td_ddir & TD_DDIR_WRITE)
27#define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)
28#define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND)
29#define file_randommap(td, f) (!(td)->o.norandommap && (f)->file_map)
30
Jens Axboe5f9099e2009-06-16 22:40:26 +020031static inline int ddir_sync(enum fio_ddir ddir)
32{
Jens Axboe44f29692010-03-09 20:09:44 +010033 return ddir == DDIR_SYNC || ddir == DDIR_DATASYNC ||
34 ddir == DDIR_SYNC_FILE_RANGE;
Jens Axboe5f9099e2009-06-16 22:40:26 +020035}
36
Jens Axboeff58fce2010-08-25 12:02:08 +020037static inline int ddir_rw(enum fio_ddir ddir)
38{
39 return ddir == DDIR_READ || ddir == DDIR_WRITE;
40}
41
Jens Axboed6aed792009-06-03 08:41:15 +020042#endif