X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=63826662f2fbba0e7fd902c01399afad2202f0a9;hp=327a3c5edc6a78e171f9a2cdeb50613f75db2d01;hb=f2e714707b27f5918a4020e3090d2b346094379c;hpb=b590a7330e0970a5c5cc58ba40542b217af76023 diff --git a/init.c b/init.c index 327a3c5e..63826662 100644 --- a/init.c +++ b/init.c @@ -22,7 +22,7 @@ #include "lib/getopt.h" -static char fio_version_string[] = "fio 1.51"; +static char fio_version_string[] = "fio 1.53"; #define FIO_RANDSEED (0xb1899bedUL) @@ -191,7 +191,7 @@ static void put_job(struct thread_data *td) { if (td == &def_thread) return; - + profile_td_exit(td); if (td->error) @@ -463,7 +463,7 @@ static int exists_and_not_file(const char *filename) return 1; } -void td_fill_rand_seeds(struct thread_data *td) +static void td_fill_rand_seeds_os(struct thread_data *td) { os_random_seed(td->rand_seeds[0], &td->bsrange_state); os_random_seed(td->rand_seeds[1], &td->verify_state); @@ -484,6 +484,35 @@ void td_fill_rand_seeds(struct thread_data *td) os_random_seed(td->rand_seeds[4], &td->random_state); } +static void td_fill_rand_seeds_internal(struct thread_data *td) +{ + init_rand_seed(&td->__bsrange_state, td->rand_seeds[0]); + init_rand_seed(&td->__verify_state, td->rand_seeds[1]); + init_rand_seed(&td->__rwmix_state, td->rand_seeds[2]); + + if (td->o.file_service_type == FIO_FSERVICE_RANDOM) + init_rand_seed(&td->__next_file_state, td->rand_seeds[3]); + + init_rand_seed(&td->__file_size_state, td->rand_seeds[5]); + init_rand_seed(&td->__trim_state, td->rand_seeds[6]); + + if (!td_random(td)) + return; + + if (td->o.rand_repeatable) + td->rand_seeds[4] = FIO_RANDSEED * td->thread_number; + + init_rand_seed(&td->__random_state, td->rand_seeds[4]); +} + +void td_fill_rand_seeds(struct thread_data *td) +{ + if (td->o.use_os_rand) + td_fill_rand_seeds_os(td); + else + td_fill_rand_seeds_internal(td); +} + /* * Initialize the various random states we need (random io, block size ranges, * read/write mix, etc). @@ -806,7 +835,7 @@ static int parse_jobs_ini(char *file, int stonewall_flag) if (is_empty_or_comment(p)) continue; - if (sscanf(p, "[%255s]", name) != 1) { + if (sscanf(p, "[%255[^\n]]", name) != 1) { if (inside_skip) continue; log_err("fio: option <%s> outside of [] job section\n",