From: Jens Axboe Date: Thu, 24 May 2007 08:32:47 +0000 (+0200) Subject: Tweak meaning of size option X-Git-Tag: fio-1.16.3~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=492158cf6a2e81886c43a6e696b17d7160ec5540;hp=281f9b6363ff7ca9fdcc93c600faa8c907ba3010 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 --- 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));