threads = NULL;
file_hash_exit();
+ flow_exit();
fio_debug_jobp = NULL;
shmdt(tp);
shmctl(shm_id, IPC_RMID, &sbuf);
shm_id = shmget(0, size, IPC_CREAT | 0600);
if (shm_id != -1)
break;
- if (errno != EINVAL) {
+ if (errno != EINVAL && errno != ENOMEM) {
perror("shmget");
break;
}
fio_debug_jobp = (void *) hash + file_hash_size;
*fio_debug_jobp = -1;
file_hash_init(hash);
+
+ flow_init();
+
return 0;
}
return;
profile_td_exit(td);
+ flow_exit_job(td);
if (td->error)
log_info("fio: %s\n", td->verror);
}
/*
- * only really works for sequential io for now, and with 1 file
+ * only really works with 1 file
*/
- if (o->zone_size && td_random(td) && o->open_files == 1)
+ if (o->zone_size && o->open_files == 1)
o->zone_size = 0;
+ /*
+ * If zone_range isn't specified, backward compatibility dictates it
+ * should be made equal to zone_size.
+ */
+ if (o->zone_size && !o->zone_range)
+ o->zone_range = o->zone_size;
+
/*
* Reads can do overwrites, we always need to pre-create the file
*/
}
#endif
+#ifdef WIN32
+ /*
+ * Windows doesn't support O_DIRECT or O_SYNC with the _open interface,
+ * so fail if we're passed those flags
+ */
+ if ((td->io_ops->flags & FIO_SYNCIO) && (td->o.odirect || td->o.sync_io)) {
+ log_err("fio: Windows does not support direct or non-buffered io with"
+ " the synchronous ioengines. Use the 'windowsaio' ioengine"
+ " with 'direct=1' and 'iodepth=1' instead.\n");
+ ret = 1;
+ }
+#endif
+
return ret;
}
init_rand_seed(&td->buf_state, td->rand_seeds[7]);
}
-/*
- * Initialize the various random states we need (random io, block size ranges,
- * read/write mix, etc).
- */
-static int init_random_state(struct thread_data *td)
-{
- int fd;
-
- fd = open("/dev/urandom", O_RDONLY);
- if (fd == -1) {
- td_verror(td, errno, "open");
- return 1;
- }
-
- if (read(fd, td->rand_seeds, sizeof(td->rand_seeds)) <
- (int) sizeof(td->rand_seeds)) {
- td_verror(td, EIO, "read");
- close(fd);
- return 1;
- }
-
- close(fd);
- td_fill_rand_seeds(td);
- return 0;
-}
/*
* Initializes the ioengine configured for a job, if it has not been done so
if (fixup_options(td))
goto err;
+ flow_init_job(td);
+
/*
* IO engines only need this for option callbacks, and the address may
* change in subprocesses.
td->groupid = groupid;
prev_group_jobs++;
- if (init_random_state(td))
+ if (init_random_state(td, td->rand_seeds, sizeof(td->rand_seeds))) {
+ td_verror(td, errno, "init_random_state");
goto err;
+ }
if (setup_rate(td))
goto err;
if (td->o.write_lat_log) {
- setup_log(&td->lat_log);
- setup_log(&td->slat_log);
- setup_log(&td->clat_log);
+ setup_log(&td->lat_log, td->o.log_avg_msec);
+ setup_log(&td->slat_log, td->o.log_avg_msec);
+ setup_log(&td->clat_log, td->o.log_avg_msec);
}
if (td->o.write_bw_log)
- setup_log(&td->bw_log);
+ setup_log(&td->bw_log, td->o.log_avg_msec);
if (td->o.write_iops_log)
- setup_log(&td->iops_log);
+ setup_log(&td->iops_log, td->o.log_avg_msec);
if (!td->o.name)
td->o.name = strdup(jobname);