iolog bug: TD_DDIR_READ should be TD_DDIR_WRITE
[fio.git] / log.c
diff --git a/log.c b/log.c
index 9669b4a7c336eb510a510679c7933d9e96c45bd1..c0e9d4ae61dc8b6b5f7d1890991745979872a7f0 100644 (file)
--- a/log.c
+++ b/log.c
@@ -158,7 +158,7 @@ static int init_iolog_read(struct thread_data *td)
        else if (reads && !writes)
                td->o.td_ddir = TD_DDIR_READ;
        else if (!reads && writes)
-               td->o.td_ddir = TD_DDIR_READ;
+               td->o.td_ddir = TD_DDIR_WRITE;
        else
                td->o.td_ddir = TD_DDIR_RW;
 
@@ -199,9 +199,16 @@ int init_iolog(struct thread_data *td)
        if (td->io_ops->flags & FIO_DISKLESSIO)
                return 0;
 
-       if (td->o.read_iolog_file)
-               ret = init_iolog_read(td);
-       else if (td->o.write_iolog_file)
+       if (td->o.read_iolog_file) {
+               /*
+                * Check if it's a blktrace file and load that if possible.
+                * Otherwise assume it's a normal log file and load that.
+                */
+               if (is_blktrace(td->o.read_iolog_file))
+                       ret = load_blktrace(td, td->o.read_iolog_file);
+               else
+                       ret = init_iolog_read(td);
+       } else if (td->o.write_iolog_file)
                ret = init_iolog_write(td);
 
        return ret;