Merge branch 'clarify-io-errors' of https://github.com/Hi-Angel/fio
[fio.git] / init.c
diff --git a/init.c b/init.c
index 139351527bebb2abe3037f2f0b09391ef6f36b84..da8007760a5f321f779c2c61e4d8297af6e29ffb 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1541,7 +1541,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
        if (fixup_options(td))
                goto err;
 
-       if (init_dedupe_working_set_seeds(td))
+       if (!td->o.dedupe_global && init_dedupe_working_set_seeds(td, 0))
                goto err;
 
        /*
@@ -1576,7 +1576,14 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
        td->ts.sig_figs = o->sig_figs;
 
        init_thread_stat_min_vals(&td->ts);
-       td->ddir_seq_nr = o->ddir_seq_nr;
+
+       /*
+        * td->>ddir_seq_nr needs to be initialized to 1, NOT o->ddir_seq_nr,
+        * so that get_next_offset gets a new random offset the first time it
+        * is called, instead of keeping an initial offset of 0 for the first
+        * nr-1 calls
+        */
+       td->ddir_seq_nr = 1;
 
        if ((o->stonewall || o->new_group) && prev_group_jobs) {
                prev_group_jobs = 0;
@@ -2178,6 +2185,10 @@ static int __parse_jobs_ini(struct thread_data *td,
                i++;
        }
 
+       free(job_sections);
+       job_sections = NULL;
+       nr_job_sections = 0;
+
        free(opts);
 out:
        free(string);
@@ -2799,6 +2810,15 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                                break;
 
                        ret = fio_cmd_ioengine_option_parse(td, opt, val);
+
+                       if (ret) {
+                               if (td) {
+                                       put_job(td);
+                                       td = NULL;
+                               }
+                               do_exit++;
+                               exit_val = 1;
+                       }
                        break;
                }
                case 'w':
@@ -2979,7 +2999,7 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        log_err("%s: unrecognized option '%s'\n", argv[0],
                                                        argv[optind - 1]);
                        show_closest_option(argv[optind - 1]);
-                       fallthrough;
+                       fio_fallthrough;
                default:
                        do_exit++;
                        exit_val = 1;