From 059e63c02b947085d28ec7c6450b51d5fb2e8d05 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 27 Mar 2007 20:34:47 +0200 Subject: [PATCH] Better check for not doing a file twice Mark it as done when we close it, so we don't open the same one again. Signed-off-by: Jens Axboe --- fio.h | 1 + io_u.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/fio.h b/fio.h index 76d7ea46..5ca72c59 100644 --- a/fio.h +++ b/fio.h @@ -240,6 +240,7 @@ enum fio_file_flags { FIO_FILE_EXISTS = 1 << 3, /* file there */ FIO_FILE_EXTEND = 1 << 4, /* needs extend */ FIO_FILE_NOSORT = 1 << 5, /* don't sort verify blocks */ + FIO_FILE_DONE = 1 << 6, /* io completed to this file */ }; /* diff --git a/io_u.c b/io_u.c index f71856fc..5f51a00e 100644 --- a/io_u.c +++ b/io_u.c @@ -422,6 +422,8 @@ static struct fio_file *get_next_file_rand(struct thread_data *td, int goodf, fno = (unsigned int) ((double) td->o.nr_files * (r / (RAND_MAX + 1.0))); f = &td->files[fno]; + if (f->flags & FIO_FILE_DONE) + continue; if ((!goodf || (f->flags & goodf)) && !(f->flags & badf)) return f; @@ -444,6 +446,9 @@ static struct fio_file *get_next_file_rr(struct thread_data *td, int goodf, if (td->next_file >= td->o.nr_files) td->next_file = 0; + if (f->flags & FIO_FILE_DONE) + continue; + if ((!goodf || (f->flags & goodf)) && !(f->flags & badf)) break; @@ -554,6 +559,7 @@ set_file: */ io_u->file = NULL; td_io_close_file(td, f); + f->flags |= FIO_FILE_DONE; /* * probably not the right place to do this, but see -- 2.25.1