X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=init.c;h=f606087e42c942e565314f20a57a038be2535d68;hb=0162683724850b047a4f2687e3946443080e2079;hp=b72689a3782cc816a0acf879e9fd1e0ef322058f;hpb=b63efd302dc3b762a21264ca66e07c74b697b608;p=fio.git diff --git a/init.c b/init.c index b72689a3..f606087e 100644 --- a/init.c +++ b/init.c @@ -565,7 +565,6 @@ static int fixup_options(struct thread_data *td) if (!o->max_bs[DDIR_TRIM]) o->max_bs[DDIR_TRIM] = o->bs[DDIR_TRIM]; - o->rw_min_bs = min(o->min_bs[DDIR_READ], o->min_bs[DDIR_WRITE]); o->rw_min_bs = min(o->min_bs[DDIR_TRIM], o->rw_min_bs); @@ -927,7 +926,13 @@ static void init_flags(struct thread_data *td) td->flags |= TD_F_READ_IOLOG; if (o->refill_buffers) td->flags |= TD_F_REFILL_BUFFERS; - if (o->scramble_buffers) + /* + * Scramble by default, but not if zero_buffer is true and has been + * set. But if scramble_buffers has been set, always scramble. + */ + if (o->scramble_buffers && ((!o->zero_buffers && + fio_option_is_set(o, zero_buffers)) || + fio_option_is_set(o, scramble_buffers))) td->flags |= TD_F_SCRAMBLE_BUFFERS; if (o->verify != VERIFY_NONE) td->flags |= TD_F_VER_NONE; @@ -1876,6 +1881,30 @@ static void parse_cmd_client(void *client, char *opt) fio_client_add_cmd_option(client, opt); } +static void show_closest_option(const char *name) +{ + int best_option, best_distance; + int i, distance; + + while (*name == '-') + name++; + + best_option = -1; + best_distance = INT_MAX; + i = 0; + while (l_opts[i].name) { + distance = string_distance(name, l_opts[i].name); + if (distance < best_distance) { + best_distance = distance; + best_option = i; + } + i++; + } + + if (best_option != -1) + log_err("Did you mean %s?\n", l_opts[best_option].name); +} + int parse_cmd_line(int argc, char *argv[], int client_type) { struct thread_data *td = NULL; @@ -2238,6 +2267,7 @@ int parse_cmd_line(int argc, char *argv[], int client_type) case '?': log_err("%s: unrecognized option '%s'\n", argv[0], argv[optind - 1]); + show_closest_option(argv[optind - 1]); default: do_exit++; exit_val = 1;