[PATCH] Add verify_meta verification type
[fio.git] / log.c
diff --git a/log.c b/log.c
index 07ba950b9e147a5dfa98c7264fcebf660a5546d0..7a3327e5d29c2909700ba3413ae1bd903ce1f197 100644 (file)
--- a/log.c
+++ b/log.c
@@ -57,44 +57,41 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u)
 {
        struct io_piece *ipo;
 
-restart:
-       if (!list_empty(&td->io_log_list)) {
+       while (!list_empty(&td->io_log_list)) {
                ipo = list_entry(td->io_log_list.next, struct io_piece, list);
                list_del(&ipo->list);
-               io_u->offset = ipo->offset;
-               io_u->buflen = ipo->len;
-               io_u->ddir = ipo->ddir;
-               io_u->file = ipo->file;
 
                /*
                 * invalid ddir, this is a file action
                 */
-               if (io_u->ddir == DDIR_INVAL) {
+               if (ipo->ddir == DDIR_INVAL) {
                        struct fio_file *f = &td->files[ipo->fileno];
 
                        if (ipo->file_action == FIO_LOG_OPEN_FILE) {
                                assert(!td_io_open_file(td, f));
                                free(ipo);
-                               goto restart;
+                               continue;
                        } else if (ipo->file_action == FIO_LOG_CLOSE_FILE) {
                                td_io_close_file(td, f);
                                free(ipo);
-                               goto restart;
+                               continue;
                        }
                }
 
+               io_u->offset = ipo->offset;
+               io_u->buflen = ipo->len;
+               io_u->ddir = ipo->ddir;
+               io_u->file = &td->files[ipo->fileno];
+               get_file(io_u->file);
+
                if (ipo->delay)
                        iolog_delay(td, ipo->delay);
 
-               /*
-                * 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;
        }
 
+       td->done = 1;
        return 1;
 }
 
@@ -177,9 +174,10 @@ static int read_iolog2(struct thread_data *td, FILE *f)
 {
        unsigned long long offset;
        unsigned int bytes;
-       int rw, reads, writes, fileno = 0, file_action = 0; /* stupid gcc */
+       int reads, writes, fileno = 0, file_action = 0; /* stupid gcc */
        char *fname, *act;
        char *str, *p;
+       enum fio_ddir rw;
 
        free_release_files(td);
 
@@ -250,7 +248,7 @@ static int read_iolog2(struct thread_data *td, FILE *f)
                INIT_LIST_HEAD(&ipo->list);
                ipo->offset = offset;
                ipo->len = bytes;
-               ipo->ddir = (enum fio_ddir) rw;
+               ipo->ddir = rw;
                if (bytes > td->o.max_bs[rw])
                        td->o.max_bs[rw] = bytes;
                if (rw == DDIR_INVAL) {
@@ -284,7 +282,8 @@ static int read_iolog(struct thread_data *td, FILE *f)
        unsigned long long offset;
        unsigned int bytes;
        char *str, *p;
-       int rw, reads, writes;
+       int reads, writes;
+       enum fio_ddir rw;
 
        /*
         * Read in the read iolog and store it, reuse the infrastructure
@@ -313,7 +312,7 @@ static int read_iolog(struct thread_data *td, FILE *f)
                INIT_LIST_HEAD(&ipo->list);
                ipo->offset = offset;
                ipo->len = bytes;
-               ipo->ddir = (enum fio_ddir) rw;
+               ipo->ddir = rw;
                if (bytes > td->o.max_bs[rw])
                        td->o.max_bs[rw] = bytes;
                list_add_tail(&ipo->list, &td->io_log_list);