summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-04-03 11:23:11 -0700
committerBart Van Assche <bart.vanassche@wdc.com>2018-04-04 13:53:45 -0700
commit45b3e8d7ea7d479103dedbf5bc56a0dc3145b312 (patch)
treee4f70c58425a9b1b420b424d1524e320ef110336 /parse.c
parent9109883a1c20c2cbadd2d2cb8ca80d03835eaa66 (diff)
downloadfio-45b3e8d7ea7d479103dedbf5bc56a0dc3145b312.tar.gz
fio-45b3e8d7ea7d479103dedbf5bc56a0dc3145b312.tar.bz2
Ensure that .minfp and .maxfp are respected for FIO_OPT_FLOAT_LIST
option_init() overwrites the .minfp and .maxfp members defined in fio_options[] which is wrong. Remove the code that overwrites these two members and change the convention for no FIO_OPT_FLOAT_LIST limits from (minfp == DBL_MIN && maxfp == DBL_MAX) into (minfp != 0 || maxfp != 0). Fixes: 833491908a1a ("stats: Add a function to report completion latency percentiles") Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/parse.c b/parse.c
index adeb63ff..deb4120f 100644
--- a/parse.c
+++ b/parse.c
@@ -71,10 +71,11 @@ static void show_option_range(const struct fio_option *o,
size_t (*logger)(const char *format, ...))
{
if (o->type == FIO_OPT_FLOAT_LIST) {
- if (o->minfp == DBL_MIN && o->maxfp == DBL_MAX)
+ if (!o->minfp && !o->maxfp)
return;
- logger("%20s: min=%f", "range", o->minfp);
+ if (o->minfp != DBL_MIN)
+ logger("%20s: min=%f", "range", o->minfp);
if (o->maxfp != DBL_MAX)
logger(", max=%f", o->maxfp);
logger("\n");
@@ -668,15 +669,17 @@ static int __handle_option(const struct fio_option *o, const char *ptr,
log_err("not a floating point value: %s\n", ptr);
return 1;
}
- if (uf > o->maxfp) {
- log_err("value out of range: %f"
- " (range max: %f)\n", uf, o->maxfp);
- return 1;
- }
- if (uf < o->minfp) {
- log_err("value out of range: %f"
- " (range min: %f)\n", uf, o->minfp);
- return 1;
+ if (o->minfp || o->maxfp) {
+ if (uf > o->maxfp) {
+ log_err("value out of range: %f"
+ " (range max: %f)\n", uf, o->maxfp);
+ return 1;
+ }
+ if (uf < o->minfp) {
+ log_err("value out of range: %f"
+ " (range min: %f)\n", uf, o->minfp);
+ return 1;
+ }
}
flp = td_var(data, o, o->off1);
@@ -1316,10 +1319,6 @@ static void option_init(struct fio_option *o)
if (!o->maxval)
o->maxval = UINT_MAX;
}
- if (o->type == FIO_OPT_FLOAT_LIST) {
- o->minfp = DBL_MIN;
- o->maxfp = DBL_MAX;
- }
if (o->type == FIO_OPT_STR_SET && o->def && !o->no_warn_def) {
log_err("Option %s: string set option with"
" default will always be true\n", o->name);