}
if (td->filetype == FIO_TYPE_FILE) {
+ char tmp[PATH_MAX];
+
if (td->directory && td->directory[0] != '\0')
- sprintf(td->file_name, "%s/%s.%d", td->directory, jobname, td->jobnum);
+ sprintf(tmp, "%s/%s.%d", td->directory, jobname, td->jobnum);
else
- sprintf(td->file_name, "%s.%d", jobname, td->jobnum);
+ sprintf(tmp, "%s.%d", jobname, td->jobnum);
+ td->file_name = strdup(tmp);
} else
- strncpy(td->file_name, jobname, sizeof(td->file_name) - 1);
+ td->file_name = strdup(jobname);
- sem_init(&td->mutex, 0, 0);
+ fio_sem_init(&td->mutex, 0);
td->clat_stat[0].min_val = td->clat_stat[1].min_val = ULONG_MAX;
td->slat_stat[0].min_val = td->slat_stat[1].min_val = ULONG_MAX;
close(fd);
- srand48_r(seeds[0], &td->bsrange_state);
- srand48_r(seeds[1], &td->verify_state);
- srand48_r(seeds[2], &td->rwmix_state);
+ os_random_seed(seeds[0], &td->bsrange_state);
+ os_random_seed(seeds[1], &td->verify_state);
+ os_random_seed(seeds[2], &td->rwmix_state);
if (td->sequential)
return 0;
td->num_maps = num_maps;
memset(td->file_map, 0, num_maps * sizeof(long));
- srand48_r(seeds[3], &td->random_state);
+ os_random_seed(seeds[3], &td->random_state);
return 0;
}
fprintf(stderr, "io priorities not available\n");
ret = 1;
break;
-#endif
+#else
td->ioprio |= prioclass << IOPRIO_CLASS_SHIFT;
fgetpos(f, &off);
continue;
+#endif
}
- if (!check_int(p, "direct", &td->odirect)) {
+ if (!check_int(p, "direct", &il)) {
+ td->odirect = il;
fgetpos(f, &off);
continue;
}
fgetpos(f, &off);
continue;
}
- if (!check_int(p, "invalidate",&td->invalidate_cache)) {
+ if (!check_int(p, "invalidate", &il)) {
+ td->invalidate_cache = il;
fgetpos(f, &off);
continue;
}
fgetpos(f, &off);
continue;
}
- if (!check_int(p, "sync", &td->sync_io)) {
+ if (!check_int(p, "sync", &il)) {
+ td->sync_io = il;
fgetpos(f, &off);
continue;
}
fgetpos(f, &off);
continue;
}
- if (!check_int(p, "create_serialize", &td->create_serialize)) {
+ if (!check_int(p, "create_serialize", &il)) {
+ td->create_serialize = il;
fgetpos(f, &off);
continue;
}
- if (!check_int(p, "create_fsync", &td->create_fsync)) {
+ if (!check_int(p, "create_fsync", &il)) {
+ td->create_fsync = il;
fgetpos(f, &off);
continue;
}
- if (!check_int(p, "end_fsync", &td->end_fsync)) {
+ if (!check_int(p, "end_fsync", &il)) {
+ td->end_fsync = il;
fgetpos(f, &off);
continue;
}
fgetpos(f, &off);
continue;
}
- if (!check_int(p, "overwrite", &td->overwrite)) {
+ if (!check_int(p, "overwrite", &il)) {
+ td->overwrite = il;
fgetpos(f, &off);
continue;
}
continue;
}
if (!check_strstore(p, "iolog", tmpbuf)) {
+ if (td->write_iolog) {
+ fprintf(stderr, "fio: read iolog overrides given write_iolog\n");
+ free(td->iolog_file);
+ td->write_iolog = 0;
+ }
td->iolog_file = strdup(tmpbuf);
td->read_iolog = 1;
- td->write_iolog = 0;
fgetpos(f, &off);
continue;
}
- if (!td->read_iolog &&
- !check_strstore(p, "write_iolog", tmpbuf)) {
- td->iolog_file = strdup(tmpbuf);
- td->write_iolog = 1;
+ if (!check_strstore(p, "write_iolog", tmpbuf)) {
+ if (!td->read_iolog) {
+ td->iolog_file = strdup(tmpbuf);
+ td->write_iolog = 1;
+ } else
+ fprintf(stderr, "fio: read iolog overrides given write_iolog\n");
fgetpos(f, &off);
continue;
}