[PATCH cpu io threads need not have lots of stuff setup
[fio.git] / init.c
diff --git a/init.c b/init.c
index 2dbf805d5abea0ee793389a5098d1edda296fd50..b0c35f1041ff454ece3dc8b6437ccb1a311426ef 100644 (file)
--- a/init.c
+++ b/init.c
@@ -104,12 +104,12 @@ static struct fio_option options[] = {
        {
                .name   = "write_iolog",
                .type   = FIO_OPT_STR_STORE,
-               .off1   = td_var_offset(write_iolog),
+               .off1   = td_var_offset(write_iolog_file),
        },
        {
-               .name   = "iolog",
+               .name   = "read_iolog",
                .type   = FIO_OPT_STR_STORE,
-               .off1   = td_var_offset(iolog),
+               .off1   = td_var_offset(read_iolog_file),
        },
        {
                .name   = "exec_prerun",
@@ -391,6 +391,10 @@ static void put_job(struct thread_data *td)
        thread_number--;
 }
 
+/*
+ * Lazy way of fixing up options that depend on each other. We could also
+ * define option callback handlers, but this is easier.
+ */
 static void fixup_options(struct thread_data *td)
 {
        if (!td->min_bs)
@@ -400,6 +404,12 @@ static void fixup_options(struct thread_data *td)
 
        if (!td->rwmixread && td->rwmixwrite)
                td->rwmixread = 100 - td->rwmixwrite;
+
+       if (td->write_iolog_file && td->read_iolog_file) {
+               log_err("fio: read iolog overrides write_iolog\n");
+               free(td->write_iolog_file);
+               td->write_iolog_file = NULL;
+       }
 }
 
 /*
@@ -594,6 +604,9 @@ int init_random_state(struct thread_data *td)
        int fd, num_maps, blocks, i;
        struct fio_file *f;
 
+       if (td->io_ops->flags & FIO_CPUIO)
+               return 0;
+
        fd = open("/dev/urandom", O_RDONLY);
        if (fd == -1) {
                td_verror(td, errno);