More iolog fixes
[fio.git] / log.c
diff --git a/log.c b/log.c
index 45be5fb6fdb94f718d3603bd769226f50abf7802..9669b4a7c336eb510a510679c7933d9e96c45bd1 100644 (file)
--- a/log.c
+++ b/log.c
@@ -19,6 +19,11 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u)
                io_u->buflen = ipo->len;
                io_u->ddir = ipo->ddir;
                io_u->file = ipo->file;
+               /*
+                * work around, this needs a format change to work for > 1 file
+                */
+               if (!io_u->file)
+                       io_u->file = &td->files[0];
                free(ipo);
                return 0;
        }
@@ -135,6 +140,7 @@ static int init_iolog_read(struct thread_data *td)
                }
 
                ipo = malloc(sizeof(*ipo));
+               memset(ipo, 0, sizeof(*ipo));
                INIT_LIST_HEAD(&ipo->list);
                ipo->offset = offset;
                ipo->len = bytes;
@@ -166,6 +172,11 @@ static int init_iolog_write(struct thread_data *td)
 {
        FILE *f;
 
+       if (td->o.nr_files > 1) {
+               log_err("fio: write_iolog only works with 1 file currently\n");
+               return 1;
+       }
+
        f = fopen(td->o.write_iolog_file, "w+");
        if (!f) {
                perror("fopen write iolog");