Add 'filesize' option
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 4d628b9f522383880c5fde1dd34d91ff179eedf1..5f06940f81e6a3b2ff7c1aeaeb4c27b197e5ddfd 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -37,7 +37,8 @@
 #include "fio.h"
 #include "os.h"
 
-static unsigned long page_mask;
+unsigned long page_mask;
+unsigned long page_size;
 #define ALIGN(buf)     \
        (char *) (((unsigned long) (buf) + page_mask) & ~page_mask)
 
@@ -263,6 +264,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 +523,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);
@@ -719,9 +726,6 @@ static void *thread_main(void *data)
                goto err_sem;
        }
 
-       if (init_random_state(td))
-               goto err_sem;
-
        if (td->ioscheduler && switch_ioscheduler(td))
                goto err_sem;
 
@@ -1152,6 +1156,7 @@ int main(int argc, char *argv[])
                return 1;
        }
 
+       page_size = ps;
        page_mask = ps - 1;
 
        if (write_bw_log) {