verify: Reset verify_state before verification phase.
authorCharlie Jacobsen <charles.jacobsen@primarydata.com>
Fri, 8 Jul 2016 17:22:29 +0000 (11:22 -0600)
committerCharlie Jacobsen <charles.jacobsen@primarydata.com>
Wed, 13 Jul 2016 16:09:06 +0000 (10:09 -0600)
verify_state needs to be reset in order for random seeds in
the verification headers and expected random seeds to match.

Signed-off-by: Charlie Jacobsen <charles.jacobsen@primarydata.com>
backend.c
fio.h
init.c

index bb0200bb2b0fdb29c80aacdc03ca1b026385191e..950333034e749154eb082e8ab3169c2794276aef 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;
 
        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;
        td_set_runstate(td, TD_VERIFYING);
 
        io_u = NULL;
diff --git a/fio.h b/fio.h
index 7e6311c8899e0403f8f7d1e93f0029a4540e7aeb..8a0ebe370a0245211fda45c3ad55be945fb06564 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 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 *);
 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 7166ea766d8a669bddf619dd105b3b8ce6b3f58d..065a71a58e1611d8388b2fc674d03ea966c139a3 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);
 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)
        init_rand_seed(&td->rwmix_state, td->rand_seeds[FIO_RAND_MIX_OFF], false);
 
        if (td->o.file_service_type == FIO_FSERVICE_RANDOM)