Check for open files on io operations
authorJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 13:50:28 +0000 (14:50 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 13:50:28 +0000 (14:50 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c
ioengines.c

diff --git a/fio.c b/fio.c
index 4d628b9..85eb22b 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -263,6 +263,8 @@ static void do_verify(struct thread_data *td)
         * 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))
@@ -520,8 +522,12 @@ static void do_io(struct thread_data *td)
 
                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);
index 185314f..b18bc9a 100644 (file)
@@ -186,6 +186,8 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
        assert((io_u->flags & IO_U_F_FLIGHT) == 0);
        io_u->flags |= IO_U_F_FLIGHT;
 
+       assert(io_u->file->flags & FIO_FILE_OPEN);
+
        io_u->error = 0;
        io_u->resid = 0;