From 40fe5e7bf13fd7b99e26ed83623d3560a7ffdc8a Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 8 May 2015 09:19:25 -0600 Subject: [PATCH] random: document default seed value Instead of hard coding this in the source, just set the default value for the 'randseed' option'. Then it's visible when looked up through --cmdhelp=randseed. Also document that randrepeat is on by default in the HOWTO, only the man page had this information. Signed-off-by: Jens Axboe --- HOWTO | 1 + init.c | 10 +++------- options.c | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/HOWTO b/HOWTO index 0808cc3a..d62d4089 100644 --- a/HOWTO +++ b/HOWTO @@ -435,6 +435,7 @@ unified_rw_reporting=bool Fio normally reports statistics on a per randrepeat=bool For random IO workloads, seed the generator in a predictable way so that results are repeatable across repetitions. + Defaults to true. randseed=int Seed the random number generators based on this seed value, to be able to control what sequence of output is being generated. diff --git a/init.c b/init.c index fa50d3c6..ba5bf2fb 100644 --- a/init.c +++ b/init.c @@ -749,7 +749,7 @@ static int fixup_options(struct thread_data *td) /* * If randseed is set, that overrides randrepeat */ - if (td->o.rand_seed) + if (fio_option_is_set(&td->o, rand_seed)) td->o.rand_repeatable = 0; if ((td->io_ops->flags & FIO_NOEXTEND) && td->o.file_append) { @@ -966,14 +966,10 @@ static int setup_random_seeds(struct thread_data *td) unsigned long seed; unsigned int i; - if (!td->o.rand_repeatable && !td->o.rand_seed) + if (!td->o.rand_repeatable && !fio_option_is_set(&td->o, rand_seed)) return init_random_state(td, td->rand_seeds, sizeof(td->rand_seeds)); - if (!td->o.rand_seed) - seed = 0x89; - else - seed = td->o.rand_seed; - + seed = td->o.rand_seed; for (i = 0; i < 4; i++) seed *= 0x9e370001UL; diff --git a/options.c b/options.c index f21ed260..e306b28b 100644 --- a/options.c +++ b/options.c @@ -1845,6 +1845,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .type = FIO_OPT_STR_VAL, .off1 = td_var_offset(rand_seed), .help = "Set the random generator seed value", + .def = "0x89", .parent = "rw", .category = FIO_OPT_C_IO, .group = FIO_OPT_G_RANDOM, -- 2.25.1