[PATCH] time_based: Avoid restarting main I/O loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Previously, when fio had written a volume of I/O equal to the size
argument, it restarted the main do_io loop.

This patch allows time_based tests to be run for longer than one
cycle in the do_io main loop. This has a couple of advantages:
 * The random number generator is not reset on each iteration
   of the loop, so running longer will reach different locations.
 * There is not a throughput-reducing point where all operations
   must be reaped before new operations are submitted.

The implementation consists of two minor changes:
 * In the do_io loop, a time_based test will not exit the loop for
   reading or writing too much data.
 * When reading or writing sequentially, the operations wrap around
   to the beginning after reading the end within the
   get_next_seq_block function.
 backend.c |    3 ++-
 io_u.c    |    3 +++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/backend.c b/backend.c
index 7343286..1d9b0a2 100644
--- a/backend.c
+++ b/backend.c
@@ -555,7 +555,8 @@ static void do_io(struct thread_data *td)
 		td_set_runstate(td, TD_RUNNING);
 	while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
-		(!flist_empty(&td->trim_list)) || !io_bytes_exceeded(td)) {
+		(!flist_empty(&td->trim_list)) || !io_bytes_exceeded(td) ||
+		td->o.time_based) {
 		struct timeval comp_time;
 		unsigned long bytes_done[2] = { 0, 0 };
 		int min_evts = 0;
diff --git a/io_u.c b/io_u.c
index 20794c3..a3ea43d 100644
--- a/io_u.c
+++ b/io_u.c
@@ -252,6 +252,9 @@ static int get_next_seq_block(struct thread_data *td, struct fio_file *f,
+       if (f->last_pos >= f->io_size && td->o.time_based)
+               f->last_pos = f->last_pos - f->io_size;
 	if (f->last_pos < f->real_file_size) {
 		unsigned long long pos;

To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Home]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Video Projectors]     [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Powered by Linux