From 95282650802cc290d38d24fa8febfc7425750a9e Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Fri, 24 Mar 2023 18:16:29 +0000 Subject: [PATCH] init: clean up random seed options - 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 --- cconv.c | 2 -- init.c | 11 +---------- options.c | 11 +---------- server.h | 2 +- thread_options.h | 3 --- 5 files changed, 3 insertions(+), 26 deletions(-) diff --git a/cconv.c b/cconv.c index 1ae38b1b..9095d519 100644 --- 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 0a6903b3..48121f14 100644 --- 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); diff --git a/options.c b/options.c index 440bff37..8193fb29 100644 --- 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", diff --git a/server.h b/server.h index 898a893d..601d3340 100644 --- 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, diff --git a/thread_options.h b/thread_options.h index 6670cbbf..a24ebee6 100644 --- a/thread_options.h +++ b/thread_options.h @@ -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; -- 2.25.1