X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=70b56e38f21b5dab4c1789234d3ee226acabaed5;hp=ff9b6d432e585e063b82556fca88f764c8f11105;hb=f9846c392d176582916c39b1925a436e79f23de1;hpb=06464907159baf7a1eeac654a023743e33f28d86 diff --git a/init.c b/init.c index ff9b6d43..70b56e38 100644 --- a/init.c +++ b/init.c @@ -621,6 +621,14 @@ static int fixup_options(struct thread_data *td) if (td->o.random_distribution != FIO_RAND_DIST_RANDOM) td->o.norandommap = 1; + /* + * If size is set but less than the min block size, complain + */ + if (o->size && o->size < td_min_bs(td)) { + log_err("fio: size too small, must be larger than the IO size: %llu\n", (unsigned long long) o->size); + ret = 1; + } + return ret; } @@ -693,6 +701,7 @@ static void td_fill_rand_seeds_os(struct thread_data *td) td->rand_seeds[FIO_RAND_BLOCK_OFF] = FIO_RANDSEED * td->thread_number; os_random_seed(td->rand_seeds[FIO_RAND_BLOCK_OFF], &td->random_state); + os_random_seed(td->rand_seeds[FIO_RAND_SEQ_RAND_OFF], &td->seq_rand_state); } static void td_fill_rand_seeds_internal(struct thread_data *td) @@ -714,6 +723,7 @@ static void td_fill_rand_seeds_internal(struct thread_data *td) td->rand_seeds[FIO_RAND_BLOCK_OFF] = FIO_RANDSEED * td->thread_number; init_rand_seed(&td->__random_state, td->rand_seeds[FIO_RAND_BLOCK_OFF]); + init_rand_seed(&td->__seq_rand_state, td->rand_seeds[FIO_RAND_SEQ_RAND_OFF]); } void td_fill_rand_seeds(struct thread_data *td) @@ -739,6 +749,10 @@ int ioengine_load(struct thread_data *td) */ if (td->io_ops) return 0; + if (!td->o.ioengine) { + log_err("fio: internal fault, no IO engine specified\n"); + return 1; + } engine = get_engine_name(td->o.ioengine); td->io_ops = load_ioengine(td, engine); @@ -1715,7 +1729,20 @@ int parse_cmd_line(int argc, char *argv[], int client_type) fio_options_set_ioengine_opts(l_opts, td); } - ret = fio_cmd_option_parse(td, opt, val); + if ((!val || !strlen(val)) && + l_opts[lidx].has_arg == required_argument) { + log_err("fio: option %s requires an argument\n", opt); + ret = 1; + } else + ret = fio_cmd_option_parse(td, opt, val); + + if (ret) { + if (td) { + put_job(td); + td = NULL; + } + do_exit++; + } if (!ret && !strcmp(opt, "ioengine")) { free_ioengine(td); @@ -1821,10 +1848,8 @@ int parse_cmd_line(int argc, char *argv[], int client_type) break; } - if (do_exit) { - if (exit_val && !(is_backend || nr_clients)) - exit(exit_val); - } + if (do_exit && !(is_backend || nr_clients)) + exit(exit_val); if (nr_clients && fio_clients_connect()) { do_exit++;