| 1 | #ifndef FIO_TRIM_H |
| 2 | #define FIO_TRIM_H |
| 3 | |
| 4 | #ifdef FIO_HAVE_TRIM |
| 5 | #include "flist.h" |
| 6 | #include "iolog.h" |
| 7 | #include "compiler/compiler.h" |
| 8 | #include "lib/types.h" |
| 9 | #include "os/os.h" |
| 10 | |
| 11 | extern bool __must_check get_next_trim(struct thread_data *td, struct io_u *io_u); |
| 12 | extern bool io_u_should_trim(struct thread_data *td, struct io_u *io_u); |
| 13 | |
| 14 | /* |
| 15 | * Determine whether a given io_u should be logged for verify or |
| 16 | * for discard |
| 17 | */ |
| 18 | static inline void remove_trim_entry(struct thread_data *td, struct io_piece *ipo) |
| 19 | { |
| 20 | if (!flist_empty(&ipo->trim_list)) { |
| 21 | flist_del_init(&ipo->trim_list); |
| 22 | td->trim_entries--; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | #else |
| 27 | static inline bool get_next_trim(struct thread_data *td, struct io_u *io_u) |
| 28 | { |
| 29 | return false; |
| 30 | } |
| 31 | static inline bool io_u_should_trim(struct thread_data *td, struct io_u *io_u) |
| 32 | { |
| 33 | return false; |
| 34 | } |
| 35 | static inline void remove_trim_entry(struct thread_data *td, struct io_piece *ipo) |
| 36 | { |
| 37 | } |
| 38 | #endif |
| 39 | |
| 40 | #endif |