X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=init.c;h=353c99bd56bfeeb1a1394b5d700b71087b2e6eae;hb=5630eccf1e7336095804ee635504dc333c4d519f;hp=9257d47c0180af0ff4635418eb4718d254297df4;hpb=4634d057febe9b4d7028e6f02963a8fd8996ac6a;p=fio.git diff --git a/init.c b/init.c index 9257d47c..353c99bd 100644 --- a/init.c +++ b/init.c @@ -574,23 +574,6 @@ static int fixed_block_size(struct thread_options *o) o->min_bs[DDIR_READ] == o->min_bs[DDIR_TRIM]; } - -static unsigned long long get_rand_start_delay(struct thread_data *td) -{ - unsigned long long delayrange; - uint64_t frand_max; - unsigned long r; - - delayrange = td->o.start_delay_high - td->o.start_delay; - - frand_max = rand_max(&td->delay_state); - r = __rand(&td->delay_state); - delayrange = (unsigned long long) ((double) delayrange * (r / (frand_max + 1.0))); - - delayrange += td->o.start_delay; - return delayrange; -} - /* * <3 Johannes */ @@ -685,8 +668,13 @@ static int fixup_options(struct thread_data *td) if (!o->file_size_high) o->file_size_high = o->file_size_low; - if (o->start_delay_high) - o->start_delay = get_rand_start_delay(td); + if (o->start_delay_high) { + if (!o->start_delay_orig) + o->start_delay_orig = o->start_delay; + o->start_delay = rand_between(&td->delay_state, + o->start_delay_orig, + o->start_delay_high); + } if (o->norandommap && o->verify != VERIFY_NONE && !fixed_block_size(o)) { @@ -1456,6 +1444,11 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, } } + if (setup_random_seeds(td)) { + td_verror(td, errno, "setup_random_seeds"); + goto err; + } + if (fixup_options(td)) goto err; @@ -1511,11 +1504,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, td->groupid = groupid; prev_group_jobs++; - if (setup_random_seeds(td)) { - td_verror(td, errno, "setup_random_seeds"); - goto err; - } - if (setup_rate(td)) goto err;