Merge branch 'fix_verify' of https://github.com/charles-jacobsen/fio
authorJens Axboe <axboe@fb.com>
Wed, 13 Jul 2016 16:13:46 +0000 (09:13 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 13 Jul 2016 16:13:46 +0000 (09:13 -0700)
backend.c
fio.h
init.c

index dc6f530..58c77cb 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -603,6 +603,15 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
        if (td->error)
                return;
 
+       /*
+        * verify_state needs to be reset before verification
+        * proceeds so that expected random seeds match actual
+        * random seeds in headers. The main loop will reset
+        * all random number generators if randrepeat is set.
+        */
+       if (!td->o.rand_repeatable)
+               td_fill_verify_state_seed(td);
+
        td_set_runstate(td, TD_VERIFYING);
 
        io_u = NULL;
diff --git a/fio.h b/fio.h
index 7e6311c..8a0ebe3 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -502,6 +502,7 @@ extern void fio_options_dup_and_init(struct option *);
 extern void fio_options_mem_dupe(struct thread_data *);
 extern void options_mem_dupe(void *data, struct fio_option *options);
 extern void td_fill_rand_seeds(struct thread_data *);
+extern void td_fill_verify_state_seed(struct thread_data *);
 extern void add_job_opts(const char **, int);
 extern char *num2str(uint64_t, int, int, int, int);
 extern int ioengine_load(struct thread_data *);
diff --git a/init.c b/init.c
index 7166ea7..065a71a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -936,12 +936,25 @@ static void init_rand_file_service(struct thread_data *td)
        }
 }
 
+void td_fill_verify_state_seed(struct thread_data *td)
+{
+       bool use64;
+
+       if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE64)
+               use64 = 1;
+       else
+               use64 = 0;
+
+       init_rand_seed(&td->verify_state, td->rand_seeds[FIO_RAND_VER_OFF],
+               use64);
+}
+
 static void td_fill_rand_seeds_internal(struct thread_data *td, bool use64)
 {
        int i;
 
        init_rand_seed(&td->bsrange_state, td->rand_seeds[FIO_RAND_BS_OFF], use64);
-       init_rand_seed(&td->verify_state, td->rand_seeds[FIO_RAND_VER_OFF], use64);
+       td_fill_verify_state_seed(td);
        init_rand_seed(&td->rwmix_state, td->rand_seeds[FIO_RAND_MIX_OFF], false);
 
        if (td->o.file_service_type == FIO_FSERVICE_RANDOM)