X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=init.c;h=065a71a58e1611d8388b2fc674d03ea966c139a3;hb=883e4841d5466955ad464ee3a6b37e009cfa80ef;hp=e8c8afb600cc488088de69cbd5d1684c23ac53d7;hpb=8c07860de982fabaaf41d44c22aa86aba2539b58;p=fio.git diff --git a/init.c b/init.c index e8c8afb6..065a71a5 100644 --- a/init.c +++ b/init.c @@ -919,32 +919,48 @@ static int exists_and_not_file(const char *filename) return 1; } +static void init_rand_file_service(struct thread_data *td) +{ + unsigned long nranges = td->o.nr_files << FIO_FSERVICE_SHIFT; + const unsigned int seed = td->rand_seeds[FIO_RAND_FILE_OFF]; + + if (td->o.file_service_type == FIO_FSERVICE_ZIPF) { + zipf_init(&td->next_file_zipf, nranges, td->zipf_theta, seed); + zipf_disable_hash(&td->next_file_zipf); + } else if (td->o.file_service_type == FIO_FSERVICE_PARETO) { + pareto_init(&td->next_file_zipf, nranges, td->pareto_h, seed); + zipf_disable_hash(&td->next_file_zipf); + } else if (td->o.file_service_type == FIO_FSERVICE_GAUSS) { + gauss_init(&td->next_file_gauss, nranges, td->gauss_dev, seed); + gauss_disable_hash(&td->next_file_gauss); + } +} + +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) init_rand_seed(&td->next_file_state, td->rand_seeds[FIO_RAND_FILE_OFF], use64); - else if (td->o.file_service_type & __FIO_FSERVICE_NONUNIFORM) { - unsigned long nranges; - - nranges = td->o.nr_files << FIO_FSERVICE_SHIFT; - - if (td->o.file_service_type == FIO_FSERVICE_ZIPF) { - zipf_init(&td->next_file_zipf, nranges, td->zipf_theta, td->rand_seeds[FIO_RAND_FILE_OFF]); - zipf_disable_hash(&td->next_file_zipf); - } else if (td->o.file_service_type == FIO_FSERVICE_PARETO) { - pareto_init(&td->next_file_zipf, nranges, td->pareto_h, td->rand_seeds[FIO_RAND_FILE_OFF]); - zipf_disable_hash(&td->next_file_zipf); - } else if (td->o.file_service_type == FIO_FSERVICE_GAUSS) { - gauss_init(&td->next_file_gauss, nranges, td->gauss_dev, td->rand_seeds[FIO_RAND_FILE_OFF]); - gauss_disable_hash(&td->next_file_gauss); - } - } + else if (td->o.file_service_type & __FIO_FSERVICE_NONUNIFORM) + init_rand_file_service(td); init_rand_seed(&td->file_size_state, td->rand_seeds[FIO_RAND_FILE_SIZE_OFF], use64); init_rand_seed(&td->trim_state, td->rand_seeds[FIO_RAND_TRIM_OFF], use64);