The random lookup would loop infinitely, if no files were
open. So check for that and check for number of files
done.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
if (td->io_ops->close_file)
td->io_ops->close_file(td, f);
+
td->nr_open_files--;
f->flags &= ~FIO_FILE_OPEN;
}
struct fio_file *files;
unsigned int files_index;
unsigned int nr_open_files;
+ unsigned int nr_done_files;
unsigned int nr_normal_files;
union {
unsigned int next_file;
assert(td->o.nr_files <= td->files_index);
- if (!td->nr_open_files)
+ if (!td->nr_open_files || td->nr_done_files >= td->o.nr_files)
return NULL;
f = td->file_service_file;
{
struct fio_file *f;
+ if (!td->nr_open_files || td->nr_done_files >= td->o.nr_files)
+ return NULL;
+
if (td->o.file_service_type == FIO_FSERVICE_RR)
f = get_next_file_rr(td, 0, FIO_FILE_OPEN);
else
io_u->file = NULL;
td_io_close_file(td, f);
f->flags |= FIO_FILE_DONE;
+ td->nr_done_files++;
/*
* probably not the right place to do this, but see