Merge branch 'fio-docs-ci' of https://github.com/vincentkfu/fio
[fio.git] / iolog.c
diff --git a/iolog.c b/iolog.c
index 1aeb7a76b2b6ca21ab8bd3d5c18e5ec200669fcb..a2cf0c1ccd6083ebf2b3c0d11686713238ad2983 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -152,10 +152,15 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u)
        while (!flist_empty(&td->io_log_list)) {
                int ret;
 
-               if (!td->io_log_blktrace && td->o.read_iolog_chunked) {
+               if (td->o.read_iolog_chunked) {
                        if (td->io_log_checkmark == td->io_log_current) {
-                               if (!read_iolog2(td))
-                                       return 1;
+                               if (td->io_log_blktrace) {
+                                       if (!read_blktrace(td))
+                                               return 1;
+                               } else {
+                                       if (!read_iolog2(td))
+                                               return 1;
+                               }
                        }
                        td->io_log_current--;
                }
@@ -355,7 +360,7 @@ void write_iolog_close(struct thread_data *td)
        td->iolog_buf = NULL;
 }
 
-static int64_t iolog_items_to_fetch(struct thread_data *td)
+int64_t iolog_items_to_fetch(struct thread_data *td)
 {
        struct timespec now;
        uint64_t elapsed;
@@ -626,8 +631,6 @@ static bool init_iolog_read(struct thread_data *td, char *fname)
        } else
                f = fopen(fname, "r");
 
-       free(fname);
-
        if (!f) {
                perror("fopen read iolog");
                return false;
@@ -709,11 +712,12 @@ bool init_iolog(struct thread_data *td)
                 */
                if (is_blktrace(fname, &need_swap)) {
                        td->io_log_blktrace = 1;
-                       ret = load_blktrace(td, fname, need_swap);
+                       ret = init_blktrace_read(td, fname, need_swap);
                } else {
                        td->io_log_blktrace = 0;
                        ret = init_iolog_read(td, fname);
                }
+               free(fname);
        } else if (td->o.write_iolog_file)
                ret = init_iolog_write(td);
        else