Fix bug with numjobs > 1, directory and filename given
[fio.git] / init.c
diff --git a/init.c b/init.c
index b4b4abe2a8d3119edd30de60b7ab15c57ffe2a7c..1e0eeccfdc6e5dcbf0b95b0fa479e111108826f6 100644 (file)
--- a/init.c
+++ b/init.c
@@ -171,8 +171,8 @@ static int fixup_options(struct thread_data *td)
 {
        struct thread_options *o = &td->o;
 
-       if (!o->rwmixread && o->rwmixwrite)
-               o->rwmixread = 100 - o->rwmixwrite;
+       if (o->rwmix[DDIR_READ] + o->rwmix[DDIR_WRITE] > 100)
+               o->rwmix[DDIR_WRITE] = 100 - o->rwmix[DDIR_READ];
 
        if (o->write_iolog_file && o->read_iolog_file) {
                log_err("fio: read iolog overrides write_iolog\n");
@@ -358,7 +358,6 @@ static int init_random_state(struct thread_data *td)
        return 0;
 }
 
-
 /*
  * Adds a job to the list of things todo. Sanitizes the various options
  * to make sure we don't have conflicts, and initializes various
@@ -369,7 +368,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
        const char *ddir_str[] = { NULL, "read", "write", "rw", NULL,
                                   "randread", "randwrite", "randrw" };
        unsigned int i;
-       struct fio_file *f;
        const char *engine;
        char fname[PATH_MAX];
        int numjobs, file_alloced;
@@ -412,18 +410,12 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
        if (fixup_options(td))
                goto err;
 
-       for_each_file(td, f, i) {
-               if (td->o.directory && f->filetype == FIO_TYPE_FILE) {
-                       sprintf(fname, "%s/%s", td->o.directory, f->file_name);
-                       f->file_name = strdup(fname);
-               }
-       }
-               
        td->mutex = fio_sem_init(0);
 
        td->ts.clat_stat[0].min_val = td->ts.clat_stat[1].min_val = ULONG_MAX;
        td->ts.slat_stat[0].min_val = td->ts.slat_stat[1].min_val = ULONG_MAX;
        td->ts.bw_stat[0].min_val = td->ts.bw_stat[1].min_val = ULONG_MAX;
+       td->ddir_nr = td->o.ddir_nr;
 
        if ((td->o.stonewall || td->o.numjobs > 1 || td->o.new_group)
             && prev_group_jobs) {