}
#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
*/
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;
char fname[PATH_MAX];
int numjobs, file_alloced;
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 (!terse_output) {
if (!job_add_num) {
+ if (is_backend)
+ fio_server_send_add_job(&td->o, td->io_ops->name);
+
if (!strcmp(td->io_ops->name, "cpuio")) {
log_info("%s: ioengine=cpu, cpuload=%u,"
" cpucycle=%u\n", td->o.name,
log_info("%s: (g=%d): rw=%s, bs=%s-%s/%s-%s,"
" ioengine=%s, iodepth=%u\n",
td->o.name, td->groupid,
- ddir_str[td->o.td_ddir],
+ ddir_str(td->o.td_ddir),
c1, c2, c3, c4,
td->io_ops->name,
td->o.iodepth);
#ifdef FIO_INC_DEBUG
struct debug_level debug_levels[] = {
- { .name = "process", .shift = FD_PROCESS, },
- { .name = "file", .shift = FD_FILE, },
- { .name = "io", .shift = FD_IO, },
- { .name = "mem", .shift = FD_MEM, },
- { .name = "blktrace", .shift = FD_BLKTRACE },
- { .name = "verify", .shift = FD_VERIFY },
- { .name = "random", .shift = FD_RANDOM },
- { .name = "parse", .shift = FD_PARSE },
- { .name = "diskutil", .shift = FD_DISKUTIL },
- { .name = "job", .shift = FD_JOB },
- { .name = "mutex", .shift = FD_MUTEX },
- { .name = "profile", .shift = FD_PROFILE },
- { .name = "time", .shift = FD_TIME },
- { .name = "net", .shift = FD_NET },
+ { .name = "process",
+ .help = "Process creation/exit logging",
+ .shift = FD_PROCESS,
+ },
+ { .name = "file",
+ .help = "File related action logging",
+ .shift = FD_FILE,
+ },
+ { .name = "io",
+ .help = "IO and IO engine action logging (offsets, queue, completions, etc)",
+ .shift = FD_IO,
+ },
+ { .name = "mem",
+ .help = "Memory allocation/freeing logging",
+ .shift = FD_MEM,
+ },
+ { .name = "blktrace",
+ .help = "blktrace action logging",
+ .shift = FD_BLKTRACE,
+ },
+ { .name = "verify",
+ .help = "IO verification action logging",
+ .shift = FD_VERIFY,
+ },
+ { .name = "random",
+ .help = "Random generation logging",
+ .shift = FD_RANDOM,
+ },
+ { .name = "parse",
+ .help = "Parser logging",
+ .shift = FD_PARSE,
+ },
+ { .name = "diskutil",
+ .help = "Disk utility logging actions",
+ .shift = FD_DISKUTIL,
+ },
+ { .name = "job",
+ .help = "Logging related to creating/destroying jobs",
+ .shift = FD_JOB,
+ },
+ { .name = "mutex",
+ .help = "Mutex logging",
+ .shift = FD_MUTEX
+ },
+ { .name = "profile",
+ .help = "Logging related to profiles",
+ .shift = FD_PROFILE,
+ },
+ { .name = "time",
+ .help = "Logging related to time keeping functions",
+ .shift = FD_TIME,
+ },
+ { .name = "net",
+ .help = "Network logging",
+ .shift = FD_NET,
+ },
{ .name = NULL, },
};
return ini_idx;
}
-int parse_options(int argc, char *argv[])
+int fio_init_options(void)
{
- int job_files, i;
-
f_out = stdout;
f_err = stderr;
if (fill_def_thread())
return 1;
+ return 0;
+}
+
+int parse_options(int argc, char *argv[])
+{
+ int job_files, i;
+
+ if (fio_init_options())
+ return 1;
+
job_files = parse_cmd_line(argc, argv);
if (job_files > 0) {