{
struct fio_file *f;
struct io_u *io_u;
- int ret, i, min_events;
+ int ret, min_events;
+ unsigned int i;
/*
* sync io first and invalidate cache, to make sure we really
* read from disk.
*/
for_each_file(td, f, i) {
+ if (!(f->flags & FIO_FILE_OPEN))
+ continue;
if (fio_io_sync(td, f))
break;
if (file_invalidate_cache(td, f))
{
struct timeval s;
unsigned long usec;
- int i, ret = 0;
+ unsigned int i;
+ int ret = 0;
td_set_runstate(td, TD_RUNNING);
if (should_fsync(td) && td->end_fsync) {
td_set_runstate(td, TD_FSYNCING);
- for_each_file(td, f, i)
+
+ for_each_file(td, f, i) {
+ if (!(f->flags & FIO_FILE_OPEN))
+ continue;
fio_io_sync(td, f);
+ }
}
} else
cleanup_pending_aio(td);
static int clear_io_state(struct thread_data *td)
{
struct fio_file *f;
- int i, ret;
+ unsigned int i;
+ int ret;
td->ts.stat_io_bytes[0] = td->ts.stat_io_bytes[1] = 0;
td->this_io_bytes[0] = td->this_io_bytes[1] = 0;