X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=1857d4115f9a80234ec8aec2bb4a591405448a70;hp=afca72705d1f3ae474ac9717348bbd7ab81de75b;hb=56d9fa4b8d4fa5166e3ec5dcdd37b5789b2cb01d;hpb=b2a9e6496494373f97f78dcdb3663fbb7b7a4ddb diff --git a/options.c b/options.c index afca7270..1857d411 100644 --- a/options.c +++ b/options.c @@ -715,9 +715,11 @@ static int str_random_distribution_cb(void *data, const char *str) return 0; if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) - val = 1.1; + val = FIO_DEF_ZIPF; else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) - val = 0.2; + val = FIO_DEF_PARETO; + else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS) + val = 0.0; else return 0; @@ -736,13 +738,14 @@ static int str_random_distribution_cb(void *data, const char *str) return 1; } td->o.zipf_theta.u.f = val; - } else { + } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) { if (val <= 0.00 || val >= 1.00) { log_err("fio: pareto input out of range (0 < input < 1.0)\n"); return 1; } td->o.pareto_h.u.f = val; - } + } else + td->o.gauss_dev = val; return 0; } @@ -884,18 +887,6 @@ out: return ret; } -static int str_lockfile_cb(void *data, const char fio_unused *str) -{ - struct thread_data *td = data; - - if (td->files_index) { - log_err("fio: lockfile= option must precede filename=\n"); - return 1; - } - - return 0; -} - static int str_opendir_cb(void *data, const char fio_unused *str) { struct thread_data *td = data; @@ -1079,16 +1070,6 @@ static int str_gtod_reduce_cb(void *data, int *il) return 0; } -static int str_gtod_cpu_cb(void *data, long long *il) -{ - struct thread_data *td = data; - int val = *il; - - td->o.gtod_cpu = val; - td->o.gtod_offload = 1; - return 0; -} - static int str_size_cb(void *data, unsigned long long *__val) { struct thread_data *td = data; @@ -1353,7 +1334,6 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .parent = "filename", .hide = 0, .def = "none", - .cb = str_lockfile_cb, .category = FIO_OPT_C_FILE, .group = FIO_OPT_G_FILENAME, .posval = { @@ -1641,8 +1621,9 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .group = FIO_OPT_G_INVALID, }, { - .name = "io_limit", - .lname = "IO Limit", + .name = "io_size", + .alias = "io_limit", + .lname = "IO Size", .type = FIO_OPT_STR_VAL, .off1 = td_var_offset(io_limit), .interval = 1024 * 1024, @@ -1897,6 +1878,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .oval = FIO_RAND_DIST_PARETO, .help = "Pareto distribution", }, + { .ival = "normal", + .oval = FIO_RAND_DIST_GAUSS, + .help = "Normal (gaussian) distribution", + }, }, .category = FIO_OPT_C_IO, .group = FIO_OPT_G_RANDOM, @@ -2027,6 +2012,17 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .category = FIO_OPT_C_FILE, .group = FIO_OPT_G_INVALID, }, +#ifdef FIO_HAVE_STREAMID + { + .name = "fadvise_stream", + .lname = "Fadvise stream", + .type = FIO_OPT_INT, + .off1 = td_var_offset(fadvise_stream), + .help = "Use fadvise() to set stream ID", + .category = FIO_OPT_C_FILE, + .group = FIO_OPT_G_INVALID, + }, +#endif { .name = "fsync", .lname = "Fsync", @@ -3403,7 +3399,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .name = "gtod_cpu", .lname = "Dedicated gettimeofday() CPU", .type = FIO_OPT_INT, - .cb = str_gtod_cpu_cb, + .off1 = td_var_offset(gtod_cpu), .help = "Set up dedicated gettimeofday() thread on this CPU", .verify = gtod_cpu_verify, .category = FIO_OPT_C_GENERAL, @@ -4200,23 +4196,32 @@ struct fio_option *fio_option_find(const char *name) return find_option(fio_options, name); } -int __fio_option_is_set(struct thread_options *o, unsigned int off1) +static struct fio_option *find_next_opt(struct thread_options *o, + struct fio_option *from, + unsigned int off1) { - unsigned int opt_off, index, offset; - struct fio_option *opt = NULL; - int i; + struct fio_option *opt; - for (i = 0; fio_options[i].name; i++) { - if (off1 == fio_options[i].off1) { - opt = &fio_options[i]; + if (!from) + from = &fio_options[0]; + else + from++; + + opt = NULL; + do { + if (off1 == from->off1) { + opt = from; break; } - } + from++; + } while (from->name); - if (!opt) { - log_err("fio: no option found at offset %u\n", off1); - return 0; - } + return opt; +} + +static int opt_is_set(struct thread_options *o, struct fio_option *opt) +{ + unsigned int opt_off, index, offset; opt_off = opt - &fio_options[0]; index = opt_off / (8 * sizeof(uint64_t)); @@ -4224,6 +4229,21 @@ int __fio_option_is_set(struct thread_options *o, unsigned int off1) return (o->set_options[index] & (1UL << offset)) != 0; } +int __fio_option_is_set(struct thread_options *o, unsigned int off1) +{ + struct fio_option *opt, *next; + + next = NULL; + while ((opt = find_next_opt(o, next, off1)) != NULL) { + if (opt_is_set(o, opt)) + return 1; + + next = opt; + } + + return 0; +} + void fio_option_mark_set(struct thread_options *o, struct fio_option *opt) { unsigned int opt_off, index, offset;