From 492158cf6a2e81886c43a6e696b17d7160ec5540 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 24 May 2007 10:32:47 +0200 Subject: [PATCH] Tweak meaning of size option Consider it the full amount of IO to be done, even if the files used are smaller. Then we'll just restart the workload until we reach the desired number of bytes. Signed-off-by: Jens Axboe --- fio.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/fio.c b/fio.c index 9e93159f..fcf3ae80 100644 --- a/fio.c +++ b/fio.c @@ -721,6 +721,24 @@ static int switch_ioscheduler(struct thread_data *td) return 0; } +static int keep_running(struct thread_data *td) +{ + unsigned long long io_done; + + if (td->o.time_based) + return 1; + if (td->o.loops) { + td->o.loops--; + return 1; + } + + io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE]; + if (io_done < td->o.size) + return 1; + + return 0; +} + static int clear_io_state(struct thread_data *td) { struct fio_file *f; @@ -838,7 +856,7 @@ static void *thread_main(void *data) runtime[0] = runtime[1] = 0; clear_state = 0; - while (td->o.time_based || td->o.loops--) { + while (keep_running(td)) { fio_gettime(&td->start, NULL); memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start)); -- 2.25.1