#include "fio.h"
#include "parse.h"
-static char fio_version_string[] = "fio 1.14a";
+static char fio_version_string[] = "fio 1.15";
#define FIO_RANDSEED (0xb1899bedUL)
td = &threads[thread_number++];
*td = *parent;
+ dup_files(td, parent);
+ options_mem_dupe(td);
+
td->thread_number = thread_number;
return 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");
static int init_random_state(struct thread_data *td)
{
unsigned long seeds[6];
- int fd, num_maps, blocks;
- struct fio_file *f;
- unsigned int i;
+ int fd;
fd = open("/dev/urandom", O_RDONLY);
if (fd == -1) {
if (td->o.rand_repeatable)
seeds[4] = FIO_RANDSEED * td->thread_number;
- if (!td->o.norandommap) {
- for_each_file(td, f, i) {
- blocks = (f->real_file_size + td->o.rw_min_bs - 1) / td->o.rw_min_bs;
- num_maps = (blocks + BLOCKS_PER_MAP-1)/ BLOCKS_PER_MAP;
- f->file_map = malloc(num_maps * sizeof(long));
- if (!f->file_map) {
- log_err("fio: failed allocating random map. If running a large number of jobs, try the 'norandommap' option\n");
- return 1;
- }
- f->num_maps = num_maps;
- memset(f->file_map, 0, num_maps * sizeof(long));
- }
- }
-
os_random_seed(seeds[4], &td->random_state);
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
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;
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) && prev_group_jobs) {
+ if ((td->o.stonewall || td->o.numjobs > 1 || td->o.new_group)
+ && prev_group_jobs) {
prev_group_jobs = 0;
groupid++;
}
td_new->o.numjobs = 1;
td_new->o.stonewall = 0;
+ td_new->o.new_group = 0;
if (file_alloced) {
td_new->o.filename = NULL;
goto err;
}
- if (td->o.numjobs > 1) {
- groupid++;
- prev_group_jobs = 0;
- }
-
return 0;
err:
put_job(td);
p = fgets(string, 4095, f);
if (!p)
break;
+
+ strip_blank_front(&p);
+ strip_blank_end(p);
+
if (is_empty_or_comment(p))
continue;
- if (sscanf(p, "[%255s]", name) != 1)
+ if (sscanf(p, "[%255s]", name) != 1) {
+ log_err("fio: option <%s> outside of job section\n", p);
continue;
+ }
global = !strncmp(name, "global", 6);
}
free(ini_file);
+ options_mem_free(&def_thread);
if (!thread_number) {
log_err("No jobs defined(s)\n");