Jens Axboe | d6aed79 | 2009-06-03 08:41:15 +0200 | [diff] [blame] | 1 | #ifndef FIO_DDIR_H |
| 2 | #define FIO_DDIR_H |
| 3 | |
| 4 | enum fio_ddir { |
| 5 | DDIR_READ = 0, |
| 6 | DDIR_WRITE, |
| 7 | DDIR_SYNC, |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 8 | DDIR_DATASYNC, |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 9 | DDIR_SYNC_FILE_RANGE, |
Glen Ogilvie | 457bf39 | 2009-11-03 21:52:36 +0100 | [diff] [blame] | 10 | DDIR_WAIT, |
Jens Axboe | a5f3027 | 2010-07-19 16:19:55 -0600 | [diff] [blame] | 11 | DDIR_TRIM, |
Jens Axboe | d6aed79 | 2009-06-03 08:41:15 +0200 | [diff] [blame] | 12 | DDIR_INVAL = -1, |
| 13 | }; |
| 14 | |
| 15 | enum 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 Axboe | 29c8e86 | 2009-06-05 22:10:51 +0200 | [diff] [blame] | 25 | #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 Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 31 | static inline int ddir_sync(enum fio_ddir ddir) |
| 32 | { |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 33 | return ddir == DDIR_SYNC || ddir == DDIR_DATASYNC || |
| 34 | ddir == DDIR_SYNC_FILE_RANGE; |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 35 | } |
| 36 | |
Jens Axboe | ff58fce | 2010-08-25 12:02:08 +0200 | [diff] [blame] | 37 | static inline int ddir_rw(enum fio_ddir ddir) |
| 38 | { |
| 39 | return ddir == DDIR_READ || ddir == DDIR_WRITE; |
| 40 | } |
| 41 | |
Jens Axboe | d6aed79 | 2009-06-03 08:41:15 +0200 | [diff] [blame] | 42 | #endif |