Add support for trim as a workload type
This only works on Linux so far, and it's always sync given what
the interface to the kernel looks like. Also restricted to pure
block devices.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/libfio.c b/libfio.c
index 668df45..43e1a61 100644
--- a/libfio.c
+++ b/libfio.c
@@ -66,13 +66,16 @@
static void reset_io_counters(struct thread_data *td)
{
- td->stat_io_bytes[0] = td->stat_io_bytes[1] = 0;
- td->this_io_bytes[0] = td->this_io_bytes[1] = 0;
- td->stat_io_blocks[0] = td->stat_io_blocks[1] = 0;
- td->this_io_blocks[0] = td->this_io_blocks[1] = 0;
+ int ddir;
+ for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++) {
+ td->stat_io_bytes[ddir] = 0;
+ td->this_io_bytes[ddir] = 0;
+ td->stat_io_blocks[ddir] = 0;
+ td->this_io_blocks[ddir] = 0;
+ td->rate_bytes[ddir] = 0;
+ td->rate_blocks[ddir] = 0;
+ }
td->zone_bytes = 0;
- td->rate_bytes[0] = td->rate_bytes[1] = 0;
- td->rate_blocks[0] = td->rate_blocks[1] = 0;
td->last_was_sync = 0;
@@ -107,16 +110,15 @@
reset_io_counters(td);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < DDIR_RWDIR_CNT; i++) {
td->io_bytes[i] = 0;
td->io_blocks[i] = 0;
td->io_issues[i] = 0;
td->ts.total_io_u[i] = 0;
+ td->ts.runtime[i] = 0;
}
fio_gettime(&tv, NULL);
- td->ts.runtime[0] = 0;
- td->ts.runtime[1] = 0;
memcpy(&td->epoch, &tv, sizeof(tv));
memcpy(&td->start, &tv, sizeof(tv));
}