From c08f9533042e909d4b4b12fdb8d14f1bc8e23dff Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Wed, 3 Aug 2022 12:21:11 -0700 Subject: [PATCH] filesetup: use correct random seed for non-uniform distributions The index in the random seed array for generating offsets is FIO_RAND_BLOCK_OFF. So this is the index that should be used to find the random seed when fio generates offsets following the Zipf, Pareto, and Gaussian distributions. The previous index 4 actually corresponds to FIO_RAND_MIX_OFF. This change means that the default sequences of non-uniform random offsets generated before and after this patch will differ. So users relying on the repeatability of I/O patterns will have new repeatable patterns after this change. Signed-off-by: Vincent Fu --- filesetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filesetup.c b/filesetup.c index e0592209..3e2ccf9b 100644 --- a/filesetup.c +++ b/filesetup.c @@ -1495,7 +1495,7 @@ static void __init_rand_distribution(struct thread_data *td, struct fio_file *f) seed = jhash(f->file_name, strlen(f->file_name), 0) * td->thread_number; if (!td->o.rand_repeatable) - seed = td->rand_seeds[4]; + seed = td->rand_seeds[FIO_RAND_BLOCK_OFF]; if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) zipf_init(&f->zipf, nranges, td->o.zipf_theta.u.f, td->o.random_center.u.f, seed); -- 2.25.1