X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=init.c;h=c1f774d8e03f42df01dd5c0298a2013d0ba6343b;hb=000b080395e45cbe0ce54e75f0e993addbdc8676;hp=b4b4abe2a8d3119edd30de60b7ab15c57ffe2a7c;hpb=b3d62a759a58bfce1822787874ea6ec8d2a0cb7f;p=fio.git diff --git a/init.c b/init.c index b4b4abe2..c1f774d8 100644 --- a/init.c +++ b/init.c @@ -115,6 +115,9 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent) td = &threads[thread_number++]; *td = *parent; + dup_files(td, parent); + options_mem_dupe(td); + td->thread_number = thread_number; return td; } @@ -171,8 +174,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 +361,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 +371,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 +413,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) { @@ -807,6 +802,7 @@ int parse_options(int argc, char *argv[]) } free(ini_file); + options_mem_free(&def_thread); if (!thread_number) { log_err("No jobs defined(s)\n");