filesetup: use correct random seed for non-uniform distributions
authorVincent Fu <vincent.fu@samsung.com>
Wed, 3 Aug 2022 19:21:11 +0000 (12:21 -0700)
committerVincent Fu <vincentfu@gmail.com>
Wed, 3 Aug 2022 20:18:53 +0000 (16:18 -0400)
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 <vincent.fu@samsung.com>
filesetup.c

index e0592209a10b12702b9230866a2a6dffe755b137..3e2ccf9b9b4061b0e943c4487f8e6a93ddd625ff 100644 (file)
@@ -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);