[PATCH] Fix random seed for numjobs > 1
authorJens Axboe <jens.axboe@oracle.com>
Sat, 17 Feb 2007 01:09:01 +0000 (02:09 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Sat, 17 Feb 2007 01:09:01 +0000 (02:09 +0100)
If you had numjobs larger than 1, then each shared job would get the
same random seed, resulting in the exact same io pattern. Multiply
the seed with the thread number, that will still get repeatable
patterns but only per-thread/process.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
init.c

diff --git a/init.c b/init.c
index 9e41d55af957a66d6a0900462d5d4ca5a8c7f038..1dec2bbd324209acf04b72e1430c4d1d5d9db2cb 100644 (file)
--- a/init.c
+++ b/init.c
@@ -845,7 +845,7 @@ int init_random_state(struct thread_data *td)
                return 0;
 
        if (td->rand_repeatable)
                return 0;
 
        if (td->rand_repeatable)
-               seeds[3] = FIO_RANDSEED;
+               seeds[3] = FIO_RANDSEED * td->thread_number;
 
        if (!td->norandommap) {
                for_each_file(td, f, i) {
 
        if (!td->norandommap) {
                for_each_file(td, f, i) {