X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=4f5b7dc03dc505cdac2909f3e39524869514414d;hp=8e1f295073c9eef96a8f09eaa9c9fd5a6a224f7b;hb=f6cbf8ac4f70c800bbbfc23c5dcf44ed619c0acc;hpb=89cdea5e2c6f2b37e11bb101e9c294a974de86ab diff --git a/init.c b/init.c index 8e1f2950..4f5b7dc0 100644 --- a/init.c +++ b/init.c @@ -48,7 +48,6 @@ static int nr_job_sections; int exitall_on_terminate = 0; int output_format = FIO_OUTPUT_NORMAL; -int append_terse_output = 0; int eta_print = FIO_ETA_AUTO; int eta_new_line = 0; FILE *f_out = NULL; @@ -69,6 +68,8 @@ long long trigger_timeout = 0; char *trigger_cmd = NULL; char *trigger_remote_cmd = NULL; +char *aux_path = NULL; + static int prev_group_jobs; unsigned long fio_debug = 0; @@ -266,6 +267,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = { .has_arg = required_argument, .val = 'J', }, + { + .name = (char *) "aux-path", + .has_arg = required_argument, + .val = 'K', + }, { .name = NULL, }, @@ -458,7 +464,7 @@ static int __setup_rate(struct thread_data *td, enum fio_ddir ddir) if (td->o.rate[ddir]) td->rate_bps[ddir] = td->o.rate[ddir]; else - td->rate_bps[ddir] = td->o.rate_iops[ddir] * bs; + td->rate_bps[ddir] = (uint64_t) td->o.rate_iops[ddir] * bs; if (!td->rate_bps[ddir]) { log_err("rate lower than supported\n"); @@ -623,6 +629,13 @@ static int fixup_options(struct thread_data *td) if (o->iodepth_batch > o->iodepth || !o->iodepth_batch) o->iodepth_batch = o->iodepth; + /* + * If max batch complete number isn't set or set incorrectly, + * default to the same as iodepth_batch_complete_min + */ + if (o->iodepth_batch_complete_min > o->iodepth_batch_complete_max) + o->iodepth_batch_complete_max = o->iodepth_batch_complete_min; + if (o->nr_files > td->files_index) o->nr_files = td->files_index; @@ -636,12 +649,12 @@ static int fixup_options(struct thread_data *td) log_err("fio: rate and rate_iops are mutually exclusive\n"); ret = 1; } - if ((o->rate[DDIR_READ] < o->ratemin[DDIR_READ]) || - (o->rate[DDIR_WRITE] < o->ratemin[DDIR_WRITE]) || - (o->rate[DDIR_TRIM] < o->ratemin[DDIR_TRIM]) || - (o->rate_iops[DDIR_READ] < o->rate_iops_min[DDIR_READ]) || - (o->rate_iops[DDIR_WRITE] < o->rate_iops_min[DDIR_WRITE]) || - (o->rate_iops[DDIR_TRIM] < o->rate_iops_min[DDIR_TRIM])) { + if ((o->rate[DDIR_READ] && (o->rate[DDIR_READ] < o->ratemin[DDIR_READ])) || + (o->rate[DDIR_WRITE] && (o->rate[DDIR_WRITE] < o->ratemin[DDIR_WRITE])) || + (o->rate[DDIR_TRIM] && (o->rate[DDIR_TRIM] < o->ratemin[DDIR_TRIM])) || + (o->rate_iops[DDIR_READ] && (o->rate_iops[DDIR_READ] < o->rate_iops_min[DDIR_READ])) || + (o->rate_iops[DDIR_WRITE] && (o->rate_iops[DDIR_WRITE] < o->rate_iops_min[DDIR_WRITE])) || + (o->rate_iops[DDIR_TRIM] && (o->rate_iops[DDIR_TRIM] < o->rate_iops_min[DDIR_TRIM]))) { log_err("fio: minimum rate exceeds rate\n"); ret = 1; } @@ -1303,7 +1316,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, if (!o->name) o->name = strdup(jobname); - if (output_format == FIO_OUTPUT_NORMAL) { + if (output_format & FIO_OUTPUT_NORMAL) { if (!job_add_num) { if (is_backend && !recursed) fio_server_send_add_job(td); @@ -1793,6 +1806,7 @@ static void usage(const char *name) printf(" --trigger-timeout=t\tExecute trigger af this time\n"); printf(" --trigger=cmd\t\tSet this command as local trigger\n"); printf(" --trigger-remote=cmd\tSet this command as remote trigger\n"); + printf(" --aux-path=path\tUse this path for fio state generated files\n"); printf("\nFio was written by Jens Axboe "); printf("\n Jens Axboe "); printf("\n Jens Axboe \n"); @@ -1990,10 +2004,39 @@ static void show_closest_option(const char *name) i++; } - if (best_option != -1) + if (best_option != -1 && string_distance_ok(name, best_distance)) log_err("Did you mean %s?\n", l_opts[best_option].name); } +static int parse_output_format(const char *optarg) +{ + char *p, *orig, *opt; + int ret = 0; + + p = orig = strdup(optarg); + + output_format = 0; + + while ((opt = strsep(&p, ",")) != NULL) { + if (!strcmp(opt, "minimal") || + !strcmp(opt, "terse") || + !strcmp(opt, "csv")) + output_format |= FIO_OUTPUT_TERSE; + else if (!strcmp(opt, "json")) + output_format |= FIO_OUTPUT_JSON; + else if (!strcmp(opt, "normal")) + output_format |= FIO_OUTPUT_NORMAL; + else { + log_err("fio: invalid output format %s\n", opt); + ret = 1; + break; + } + } + + free(orig); + return ret; +} + int parse_cmd_line(int argc, char *argv[], int client_type) { struct thread_data *td = NULL; @@ -2055,17 +2098,15 @@ int parse_cmd_line(int argc, char *argv[], int client_type) do_exit++; break; } - if (!strcmp(optarg, "minimal") || - !strcmp(optarg, "terse") || - !strcmp(optarg, "csv")) - output_format = FIO_OUTPUT_TERSE; - else if (!strcmp(optarg, "json")) - output_format = FIO_OUTPUT_JSON; - else - output_format = FIO_OUTPUT_NORMAL; + if (parse_output_format(optarg)) { + log_err("fio: failed parsing output-format\n"); + exit_val = 1; + do_exit++; + break; + } break; case 'f': - append_terse_output = 1; + output_format |= FIO_OUTPUT_TERSE; break; case 'h': did_arg = 1; @@ -2383,6 +2424,11 @@ int parse_cmd_line(int argc, char *argv[], int client_type) free(trigger_remote_cmd); trigger_remote_cmd = strdup(optarg); break; + case 'K': + if (aux_path) + free(aux_path); + aux_path = strdup(optarg); + break; case 'B': if (check_str_time(optarg, &trigger_timeout, 1)) { log_err("fio: failed parsing time %s\n", optarg); @@ -2512,7 +2558,7 @@ int parse_options(int argc, char *argv[]) return 0; } - if (output_format == FIO_OUTPUT_NORMAL) + if (output_format & FIO_OUTPUT_NORMAL) log_info("%s\n", fio_version_string); return 0;