X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=options.c;h=ae8598825e048a783da985bf9c6d89b8fb2530a2;hb=2caefeecf95c2e01ccffc3e286d17a84b12f4dc1;hp=05a6a5081fa576810c9071506e634077ec27a401;hpb=e25839d4cb5fefcb5ffce76128a4faedb177e7af;p=fio.git diff --git a/options.c b/options.c index 05a6a508..ae859882 100644 --- a/options.c +++ b/options.c @@ -734,20 +734,36 @@ static int str_random_distribution_cb(void *data, const char *str) double val; char *nr; - if (td->o.random_distribution == FIO_RAND_DIST_RANDOM) + if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) + val = 1.1; + else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) + val = 0.2; + else return 0; nr = get_opt_postfix(str); - if (!nr) - val = 0.6; - else if (!str_to_float(nr, &val)) { + if (nr && !str_to_float(nr, &val)) { log_err("fio: random postfix parsing failed\n"); free(nr); return 1; } - td->o.zipf_theta = val; free(nr); + + if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) { + if (val == 1.00) { + log_err("fio: zipf theta must different than 1.0\n"); + return 1; + } + td->o.zipf_theta = val; + } else { + 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 = val; + } + return 0; } @@ -1511,6 +1527,10 @@ static struct fio_option options[FIO_MAX_OPTS] = { .oval = FIO_RAND_DIST_ZIPF, .help = "Zipf distribution", }, + { .ival = "pareto", + .oval = FIO_RAND_DIST_PARETO, + .help = "Pareto distribution", + }, }, }, {