X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=init.c;h=e9e49ebb3e478f6db4733714a1663ca567969843;hb=f0cc675fd0a5902f3637a91024082d2d24a665a7;hp=c3996a76c12840e3ab3cf6514e5d5dce611a1077;hpb=c0c4b1d42e39c2ea4cb2d58e5a17aec4b00263d9;p=fio.git diff --git a/init.c b/init.c index c3996a76..e9e49ebb 100644 --- a/init.c +++ b/init.c @@ -24,6 +24,7 @@ #include "profile.h" #include "server.h" #include "idletime.h" +#include "filelock.h" #include "lib/getopt.h" #include "lib/strcasestr.h" @@ -37,7 +38,7 @@ const char fio_version_string[] = FIO_VERSION; static char **ini_file; static int max_jobs = FIO_MAX_JOBS; static int dump_cmdline; -static int def_timeout; +static long long def_timeout; static int parse_only; static struct thread_data def_thread; @@ -259,6 +260,7 @@ static void free_shm(void) } options_free(fio_options, &def_thread); + fio_filelock_exit(); scleanup(); } @@ -316,6 +318,14 @@ static int setup_thread_area(void) return 0; } +static void set_cmd_options(struct thread_data *td) +{ + struct thread_options *o = &td->o; + + if (!o->timeout) + o->timeout = def_timeout; +} + /* * Return a free job structure. */ @@ -324,8 +334,10 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent, { struct thread_data *td; - if (global) + if (global) { + set_cmd_options(&def_thread); return &def_thread; + } if (setup_thread_area()) { log_err("error: failed to setup shm segment\n"); return NULL; @@ -355,6 +367,7 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent, if (!parent || !parent->o.group_reporting) stat_number++; + set_cmd_options(td); return td; } @@ -1438,8 +1451,8 @@ static int fill_def_thread(void) memset(&def_thread, 0, sizeof(def_thread)); fio_getaffinity(getpid(), &def_thread.o.cpumask); - def_thread.o.timeout = def_timeout; def_thread.o.error_dump = 1; + /* * fill default options */ @@ -1693,7 +1706,11 @@ int parse_cmd_line(int argc, char *argv[], int client_type) smalloc_pool_size = atoi(optarg); break; case 't': - def_timeout = atoi(optarg); + if (check_str_time(optarg, &def_timeout, 1)) { + log_err("fio: failed parsing time %s\n", optarg); + do_exit++; + exit_val = 1; + } break; case 'l': write_lat_log = 1; @@ -1963,11 +1980,8 @@ int parse_cmd_line(int argc, char *argv[], int client_type) if (do_exit && !(is_backend || nr_clients)) exit(exit_val); - if (nr_clients && fio_clients_connect()) { - do_exit++; - exit_val = 1; - return -1; - } + if (nr_clients && fio_clients_connect()) + exit(1); if (is_backend && backend) return fio_start_server(pid_file); @@ -2019,7 +2033,7 @@ int parse_options(int argc, char *argv[]) if (job_files > 0) { for (i = 0; i < job_files; i++) { - if (fill_def_thread()) + if (i && fill_def_thread()) return 1; if (nr_clients) { if (fio_clients_send_ini(ini_file[i]))