From 8f380de25d7c9753223069d1536e344f818309e9 Mon Sep 17 00:00:00 2001 From: Charlie Jacobsen Date: Fri, 8 Jul 2016 11:22:29 -0600 Subject: [PATCH] verify: Reset verify_state before verification phase. 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 --- backend.c | 9 +++++++++ fio.h | 1 + init.c | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/backend.c b/backend.c index bb0200bb..95033303 100644 --- 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 7e6311c8..8a0ebe37 100644 --- 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 7166ea76..065a71a5 100644 --- 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) -- 2.25.1