From 8bdcfab5c81e7f842180b74d34ba6830a8d3e38c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 27 Oct 2005 12:57:59 +0200 Subject: [PATCH] [PATCH] fio: Move file creating even earlier and fix bug in setup_rate() --- fio.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/fio.c b/fio.c index 435db19..f32f96f 100644 --- a/fio.c +++ b/fio.c @@ -1291,6 +1291,11 @@ static int add_job(struct thread_data *td, const char *filename, int prioclass, if (td->use_aio && !td->aio_depth) td->aio_depth = 1; + if (td->min_bs == -1) + td->min_bs = td->bs; + if (td->max_bs == -1) + td->max_bs = td->bs; + if (setup_rate(td)) return -1; @@ -1299,11 +1304,6 @@ static int add_job(struct thread_data *td, const char *filename, int prioclass, if (write_bw_log) setup_log(&td->bw_log); - if (td->min_bs == -1) - td->min_bs = td->bs; - if (td->max_bs == -1) - td->max_bs = td->bs; - printf("Client%d: file=%s, rw=%d, prio=%d/%d, seq=%d, odir=%d, bs=%d-%d, rate=%d, aio=%d, aio_depth=%d\n", td->thread_number, filename, td->ddir, prioclass, prio, td->sequential, td->odirect, td->min_bs, td->max_bs, td->rate, td->use_aio, td->aio_depth); return 0; } @@ -1946,8 +1946,6 @@ static void run_threads(char *argv[]) unsigned long spent; int i, todo, nr_running, m_rate, t_rate; - gettimeofday(&genesis, NULL); - printf("Starting %d threads\n", thread_number); fflush(stdout); @@ -1957,6 +1955,22 @@ static void run_threads(char *argv[]) nr_running = 0; m_rate = t_rate = 0; + for (i = 0; i < thread_number; i++) { + td = &threads[i]; + + /* + * do file setup here so it happens sequentially, + * we don't want X number of threads getting their + * client data interspersed on disk + */ + if (setup_file(td)) { + td->runstate = TD_REAPED; + todo--; + } + } + + gettimeofday(&genesis, NULL); + while (todo) { /* * create threads (TD_NOT_CREATED -> TD_CREATED) @@ -1983,16 +1997,6 @@ static void run_threads(char *argv[]) continue; } - /* - * do file setup here so it happens sequentially, - * we don't want X number of threads getting their - * client data interspersed on disk - */ - if (setup_file(td)) { - td->terminate = 1; - continue; - } - td->runstate = TD_CREATED; run_str[td->thread_number - 1] = 'C'; sem_init(&startup_sem, 1, 1); -- 2.25.1