init: clean up random seed options
[fio.git] / init.c
diff --git a/init.c b/init.c
index e020d452f973413950a70f855a49b35684f686dc..48121f1496c2d7d6e1b2e57b9f16bf5f5c0768b3 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1020,12 +1020,18 @@ static void init_rand_file_service(struct thread_data *td)
        }
 }
 
-static void td_fill_rand_seeds_internal(struct thread_data *td, bool use64)
+void td_fill_rand_seeds(struct thread_data *td)
 {
        uint64_t read_seed = td->rand_seeds[FIO_RAND_BS_OFF];
        uint64_t write_seed = td->rand_seeds[FIO_RAND_BS1_OFF];
        uint64_t trim_seed = td->rand_seeds[FIO_RAND_BS2_OFF];
        int i;
+       bool use64;
+
+       if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE64)
+               use64 = true;
+       else
+               use64 = false;
 
        /*
         * trimwrite is special in that we need to generate the same
@@ -1075,22 +1081,6 @@ static void td_fill_rand_seeds_internal(struct thread_data *td, bool use64)
        frand_copy(&td->buf_state_prev, &td->buf_state);
 }
 
-void td_fill_rand_seeds(struct thread_data *td)
-{
-       bool use64;
-
-       if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE64)
-               use64 = true;
-       else
-               use64 = false;
-
-       td_fill_rand_seeds_internal(td, use64);
-
-       dprint(FD_RANDOM, "FIO_RAND_NR_OFFS=%d\n", FIO_RAND_NR_OFFS);
-       for (int i = 0; i < FIO_RAND_NR_OFFS; i++)
-               dprint(FD_RANDOM, "rand_seeds[%d]=%" PRIu64 "\n", i, td->rand_seeds[i]);
-}
-
 static int setup_random_seeds(struct thread_data *td)
 {
        uint64_t seed;
@@ -1098,6 +1088,7 @@ static int setup_random_seeds(struct thread_data *td)
 
        if (!td->o.rand_repeatable && !fio_option_is_set(&td->o, rand_seed)) {
                int ret = init_random_seeds(td->rand_seeds, sizeof(td->rand_seeds));
+               dprint(FD_RANDOM, "using system RNG for random seeds\n");
                if (ret)
                        return ret;
        } else {
@@ -1111,17 +1102,12 @@ static int setup_random_seeds(struct thread_data *td)
                }
        }
 
-       if (td->o.allrand_repeatable) {
-               unsigned int i;
-
-               for (i = 0; i < FIO_RAND_NR_OFFS; i++)
-                       td->rand_seeds[i] = FIO_RANDSEED * td->thread_number + i;
-       }
+       td_fill_rand_seeds(td);
 
-       if (td->o.rand_repeatable)
-               td->rand_seeds[FIO_RAND_BLOCK_OFF] = FIO_RANDSEED * td->thread_number;
+       dprint(FD_RANDOM, "FIO_RAND_NR_OFFS=%d\n", FIO_RAND_NR_OFFS);
+       for (int i = 0; i < FIO_RAND_NR_OFFS; i++)
+               dprint(FD_RANDOM, "rand_seeds[%d]=%" PRIu64 "\n", i, td->rand_seeds[i]);
 
-       td_fill_rand_seeds(td);
        return 0;
 }