More iolog fixes
authorJens Axboe <jens.axboe@oracle.com>
Wed, 25 Apr 2007 12:24:12 +0000 (14:24 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 25 Apr 2007 12:24:12 +0000 (14:24 +0200)
- Warn if nrfiles > 1, so that the user knows it's not supported
- Need to clear ipo on malloc, or ->file could be some random value.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
log.c

diff --git a/log.c b/log.c
index de3b759ce8ca268a007793c1b3ac9352e1bd8f3e..9669b4a7c336eb510a510679c7933d9e96c45bd1 100644 (file)
--- a/log.c
+++ b/log.c
@@ -140,6 +140,7 @@ static int init_iolog_read(struct thread_data *td)
                }
 
                ipo = malloc(sizeof(*ipo));
                }
 
                ipo = malloc(sizeof(*ipo));
+               memset(ipo, 0, sizeof(*ipo));
                INIT_LIST_HEAD(&ipo->list);
                ipo->offset = offset;
                ipo->len = bytes;
                INIT_LIST_HEAD(&ipo->list);
                ipo->offset = offset;
                ipo->len = bytes;
@@ -171,6 +172,11 @@ static int init_iolog_write(struct thread_data *td)
 {
        FILE *f;
 
 {
        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");
        f = fopen(td->o.write_iolog_file, "w+");
        if (!f) {
                perror("fopen write iolog");