From: Jens Axboe Date: Tue, 27 Mar 2007 18:34:47 +0000 (+0200) Subject: Better check for not doing a file twice X-Git-Tag: fio-1.15~8 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=059e63c02b947085d28ec7c6450b51d5fb2e8d05;ds=sidebyside 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 --- 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