Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Jun 12, 2018

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit ab5643cb04dac549b2202231d5c6e33339b7fe7d:

  stat: fix --bandwidth-log segfault (2018-06-08 08:31:20 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 49050b56681b17968256702a7a3ec0f545c7dad8:

Fix start delay being the same across threads (2018-06-11 20:02:10 -0600)

----------------------------------------------------------------
Jens Axboe (1):
Fix start delay being the same across threads

 init.c           | 20 +++++++++++---------
 thread_options.h |  1 +
 2 files changed, 12 insertions(+), 9 deletions(-)

---

Diff of recent changes:

init.c +11 -9
index 9257d47..e25e5e4 100644
@@ -578,8 +578,7 @@ static int fixed_block_size(struct thread_options *o)
 static unsigned long long get_rand_start_delay(struct thread_data *td)
 {
 	unsigned long long delayrange;
-	uint64_t frand_max;
-	unsigned long r;
+	uint64_t r, frand_max;
 
 	delayrange = td->o.start_delay_high - td->o.start_delay;
 
@@ -587,7 +586,7 @@ static unsigned long long get_rand_start_delay(struct thread_data *td)
 	r = __rand(&td->delay_state);
 	delayrange = (unsigned long long) ((double) delayrange * (r / (frand_max + 1.0)));
 
-	delayrange += td->o.start_delay;
+	delayrange += td->o.start_delay_orig;
 	return delayrange;
 }
 
@@ -685,8 +684,11 @@ 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)
+	if (o->start_delay_high) {
+		if (!o->start_delay_orig)
+			o->start_delay_orig = o->start_delay;
 		o->start_delay = get_rand_start_delay(td);
+	}
 
 	if (o->norandommap && o->verify != VERIFY_NONE
 	    && !fixed_block_size(o))  {
@@ -1456,6 +1458,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 +1518,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;
 
thread_options.h +1 -0
index 52026e3..8d13b79 100644
@@ -172,6 +172,7 @@ struct thread_options {
 	unsigned int fdatasync_blocks;
 	unsigned int barrier_blocks;
 	unsigned long long start_delay;
+	unsigned long long start_delay_orig;
 	unsigned long long start_delay_high;
 	unsigned long long timeout;
 	unsigned long long ramp_time;