init: clean up random seed options
authorVincent Fu <vincent.fu@samsung.com>
Fri, 24 Mar 2023 18:16:29 +0000 (18:16 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Thu, 13 Apr 2023 17:33:00 +0000 (13:33 -0400)
- make allrandrepeat a synonym of randrepeat. allrandrepeat is
  superfluous because the seeds set by randrepeat already encompass
  random number generators beyond the one used for random offsets.
- allow randseed to override [all]randrepeat: this is what the
  documentation implies but was not previously the case

This is a breaking change for users relying on the values of fio's
default random seeds.

Link: https://github.com/axboe/fio/pull/1546
Fixes: https://github.com/axboe/fio/issues/1502
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
cconv.c
init.c
options.c
server.h
thread_options.h

diff --git a/cconv.c b/cconv.c
index 1ae38b1be673c19b3508426d5fc4a2c71c6135a9..9095d5195eb2d1c4592e27f0b87cd0adaa925fba 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -206,7 +206,6 @@ int convert_thread_options_to_cpu(struct thread_options *o,
        o->do_disk_util = le32_to_cpu(top->do_disk_util);
        o->override_sync = le32_to_cpu(top->override_sync);
        o->rand_repeatable = le32_to_cpu(top->rand_repeatable);
-       o->allrand_repeatable = le32_to_cpu(top->allrand_repeatable);
        o->rand_seed = le64_to_cpu(top->rand_seed);
        o->log_entries = le32_to_cpu(top->log_entries);
        o->log_avg_msec = le32_to_cpu(top->log_avg_msec);
@@ -446,7 +445,6 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->do_disk_util = cpu_to_le32(o->do_disk_util);
        top->override_sync = cpu_to_le32(o->override_sync);
        top->rand_repeatable = cpu_to_le32(o->rand_repeatable);
-       top->allrand_repeatable = cpu_to_le32(o->allrand_repeatable);
        top->rand_seed = __cpu_to_le64(o->rand_seed);
        top->log_entries = cpu_to_le32(o->log_entries);
        top->log_avg_msec = cpu_to_le32(o->log_avg_msec);
diff --git a/init.c b/init.c
index 0a6903b362a7d2baea86a4870dcace3910c2d68e..48121f1496c2d7d6e1b2e57b9f16bf5f5c0768b3 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1088,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 {
@@ -1101,16 +1102,6 @@ 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;
-       }
-
-       if (td->o.rand_repeatable)
-               td->rand_seeds[FIO_RAND_BLOCK_OFF] = FIO_RANDSEED * td->thread_number;
-
        td_fill_rand_seeds(td);
 
        dprint(FD_RANDOM, "FIO_RAND_NR_OFFS=%d\n", FIO_RAND_NR_OFFS);
index 440bff37cb131fcbc4b8f9e8d10da449d7aa5709..8193fb29fe2b1cdfab8e745b9522aeb507f5361e 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2465,6 +2465,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
        },
        {
                .name   = "randrepeat",
+               .alias  = "allrandrepeat",
                .lname  = "Random repeatable",
                .type   = FIO_OPT_BOOL,
                .off1   = offsetof(struct thread_options, rand_repeatable),
@@ -2594,16 +2595,6 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_RANDOM,
        },
-       {
-               .name   = "allrandrepeat",
-               .lname  = "All Random Repeat",
-               .type   = FIO_OPT_BOOL,
-               .off1   = offsetof(struct thread_options, allrand_repeatable),
-               .help   = "Use repeatable random numbers for everything",
-               .def    = "0",
-               .category = FIO_OPT_C_IO,
-               .group  = FIO_OPT_G_RANDOM,
-       },
        {
                .name   = "nrfiles",
                .lname  = "Number of files",
index 898a893dec944bcdbc752e1d7552e7f77ac37e71..601d3340435167aa99428b6b922d7a89104c83ce 100644 (file)
--- a/server.h
+++ b/server.h
@@ -51,7 +51,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-       FIO_SERVER_VER                  = 99,
+       FIO_SERVER_VER                  = 100,
 
        FIO_SERVER_MAX_FRAGMENT_PDU     = 1024,
        FIO_SERVER_MAX_CMD_MB           = 2048,
index 6670cbbfac0227a7227e2ef3c917dac49413efc1..a24ebee69c47af1b82643cd73a2446bb80d88f98 100644 (file)
@@ -162,7 +162,6 @@ struct thread_options {
        unsigned int do_disk_util;
        unsigned int override_sync;
        unsigned int rand_repeatable;
-       unsigned int allrand_repeatable;
        unsigned long long rand_seed;
        unsigned int log_avg_msec;
        unsigned int log_hist_msec;
@@ -485,8 +484,6 @@ struct thread_options_pack {
        uint32_t do_disk_util;
        uint32_t override_sync;
        uint32_t rand_repeatable;
-       uint32_t allrand_repeatable;
-       uint32_t pad2;
        uint64_t rand_seed;
        uint32_t log_avg_msec;
        uint32_t log_hist_msec;