Add ->done variable to force exit when we know we are done
authorJens Axboe <jens.axboe@oracle.com>
Mon, 23 Jul 2007 12:36:16 +0000 (14:36 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 23 Jul 2007 12:36:16 +0000 (14:36 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c
fio.h
log.c

diff --git a/fio.c b/fio.c
index 16e19c8fa8e080511c6e07c96691c809e8955b0a..bc837c444b91c7b8ad3c6c4a56317856f9bdf1ff 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -724,6 +724,8 @@ static int keep_running(struct thread_data *td)
 {
        unsigned long long io_done;
 
+       if (td->done)
+               return 0;
        if (td->o.time_based)
                return 1;
        if (td->o.loops) {
diff --git a/fio.h b/fio.h
index b7d8582ebdcba3fc1c7b6a3c99e2b434cabbd8ed..ace4b1646342bc4f30d4fba539763000eb6b5745 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -472,6 +472,7 @@ struct thread_data {
                os_random_state_t next_file_state;
        };
        int error;
+       int done;
        pid_t pid;
        char *orig_buffer;
        size_t orig_buffer_size;
diff --git a/log.c b/log.c
index cc90f437041dcc6723f673c76b1c9c992d0077ec..7a3327e5d29c2909700ba3413ae1bd903ce1f197 100644 (file)
--- a/log.c
+++ b/log.c
@@ -91,6 +91,7 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u)
                return 0;
        }
 
+       td->done = 1;
        return 1;
 }