[PATCH] Sync and invalidate cache prior to running verify
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index cf85765ec2423c3d5a4e3bd1583c1ed8473636d6..5432e383d439319eb918b3dd4162c2df774b0337 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -553,31 +553,26 @@ static void cleanup_pending_aio(struct thread_data *td)
        }
 }
 
-static int do_io_u_verify(struct thread_data *td, struct io_u **io_u)
-{
-       struct io_u *v_io_u = *io_u;
-       int ret = 0;
-
-       if (v_io_u) {
-               ret = verify_io_u(v_io_u);
-               put_io_u(td, v_io_u);
-               *io_u = NULL;
-       }
-
-       return ret;
-}
-
 /*
  * The main verify engine. Runs over the writes we previusly submitted,
  * reads the blocks back in, and checks the crc/md5 of the data.
  */
-static void do_verify(struct thread_data *td)
+void do_verify(struct thread_data *td)
 {
        struct timeval t;
        struct io_u *io_u, *v_io_u = NULL;
        struct io_completion_data icd;
        struct fio_file *f;
-       int ret;
+       int ret, i;
+
+       /*
+        * sync io first and invalidate cache, to make sure we really
+        * read from disk.
+        */
+       for_each_file(td, f, i) {
+               td_io_sync(td, f);
+               file_invalidate_cache(td, f);
+       }
 
        td_set_runstate(td, TD_VERIFYING);