iolog: Keep full path for logs files
[fio.git] / iolog.c
diff --git a/iolog.c b/iolog.c
index 9bcf0d8e2982e37ce5d48fbd64e9653872e54ea0..7cb633b61550a77bfaa0282fb0cb9885b387f198 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -188,6 +188,10 @@ void log_io_piece(struct thread_data *td, struct io_u *io_u)
        ipo->file = io_u->file;
        ipo->offset = io_u->offset;
        ipo->len = io_u->buflen;
+       ipo->numberio = io_u->numberio;
+       ipo->flags = IP_F_IN_FLIGHT;
+
+       io_u->ipo = ipo;
 
        if (io_u_should_trim(td, io_u)) {
                flist_add_tail(&ipo->trim_list, &td->trim_list);
@@ -208,7 +212,7 @@ void log_io_piece(struct thread_data *td, struct io_u *io_u)
         * drop the old one, which we rely on the rb insert/lookup for
         * handling.
         */
-       if ((!td_random(td) || !td->o.overwrite) &&
+       if (((!td->o.verifysort) || !td_random(td) || !td->o.overwrite) &&
              (file_randommap(td, ipo->file) || td->o.verify == VERIFY_NONE)) {
                INIT_FLIST_HEAD(&ipo->list);
                flist_add_tail(&ipo->list, &td->io_hist_list);
@@ -319,8 +323,7 @@ static int read_iolog2(struct thread_data *td, FILE *f)
                } else if (r == 2) {
                        rw = DDIR_INVAL;
                        if (!strcmp(act, "add")) {
-                               td->o.nr_files++;
-                               fileno = add_file(td, fname);
+                               fileno = add_file(td, fname, 0, 1);
                                file_action = FIO_LOG_ADD_FILE;
                                continue;
                        } else if (!strcmp(act, "open")) {
@@ -480,17 +483,22 @@ int init_iolog(struct thread_data *td)
        int ret = 0;
 
        if (td->o.read_iolog_file) {
+               int need_swap;
+
                /*
                 * 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);
+               if (is_blktrace(td->o.read_iolog_file, &need_swap))
+                       ret = load_blktrace(td, td->o.read_iolog_file, need_swap);
                else
                        ret = init_iolog_read(td);
        } else if (td->o.write_iolog_file)
                ret = init_iolog_write(td);
 
+       if (ret)
+               td_verror(td, EINVAL, "failed initializing iolog");
+
        return ret;
 }
 
@@ -533,17 +541,16 @@ void __finish_log(struct io_log *log, const char *name)
 void finish_log_named(struct thread_data *td, struct io_log *log,
                       const char *prefix, const char *postfix)
 {
-       char file_name[256], *p;
+       char file_name[256];
 
        snprintf(file_name, sizeof(file_name), "%s_%s.log", prefix, postfix);
-       p = basename(file_name);
 
        if (td->client_type == FIO_CLIENT_TYPE_GUI) {
-               fio_send_iolog(td, log, p);
+               fio_send_iolog(td, log, file_name);
                free(log->log);
                free(log);
        } else
-               __finish_log(log, p);
+               __finish_log(log, file_name);
 }
 
 void finish_log(struct thread_data *td, struct io_log *log, const char *name)