From 54833d02a6ac307a894ed4445db9fe25e530b518 Mon Sep 17 00:00:00 2001 From: aggieNick02 Date: Tue, 15 Feb 2022 11:59:34 -0600 Subject: [PATCH] Fix : suffix with random read/write causing 0 initial offset When using the : suffix with random reads or writes, the initial offset would be set to 0 for the first nr-1 operations. This happened because td->ddir_seq_nr was initialized to the specified option value, when it needs to always be initialized to 1, so that the first call to get_next_offset leads to choosing a new random offset for the first nr operations. Signed-off-by: Nick Neumann nick@pcpartpicker.com --- init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init.c b/init.c index 13935152..81c30f8c 100644 --- a/init.c +++ b/init.c @@ -1576,7 +1576,14 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, td->ts.sig_figs = o->sig_figs; init_thread_stat_min_vals(&td->ts); - td->ddir_seq_nr = o->ddir_seq_nr; + + /* + * td->>ddir_seq_nr needs to be initialized to 1, NOT o->ddir_seq_nr, + * so that get_next_offset gets a new random offset the first time it + * is called, instead of keeping an initial offset of 0 for the first + * nr-1 calls + */ + td->ddir_seq_nr = 1; if ((o->stonewall || o->new_group) && prev_group_jobs) { prev_group_jobs = 0; -- 2.25.1