Silence 'io_u might be used uninitialized' warning
[fio.git] / blktrace.c
index 04648a08ffdf8005fe87fbddf9a9ca542c823396..4b5567effe6ab2624079df36284df4ad524d0f19 100644 (file)
@@ -217,9 +217,12 @@ static int trace_add_file(struct thread_data *td, __u32 device)
 
                dprint(FD_BLKTRACE, "add devices %s\n", dev);
                fileno = add_file_exclusive(td, dev);
+               td->files[fileno]->major = maj;
+               td->files[fileno]->minor = min;
                trace_add_open_close_event(td, fileno, FIO_LOG_OPEN_FILE);
                last_fileno = fileno;
        }
+
        return last_fileno;
 }
 
@@ -368,7 +371,7 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap)
        unsigned int cpu;
        unsigned int rw_bs[2];
        struct fifo *fifo;
-       int fd, i;
+       int fd, i, old_state;
        struct fio_file *f;
 
        fd = open(filename, O_RDONLY);
@@ -379,6 +382,8 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap)
 
        fifo = fifo_alloc(TRACE_FIFO_SIZE);
 
+       old_state = td_bump_runstate(td, TD_SETTING_UP);
+
        td->o.size = 0;
 
        cpu = 0;
@@ -450,13 +455,20 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap)
        } while (1);
 
        for (i = 0; i < td->files_index; i++) {
-               f= td->files[i];
+               f = td->files[i];
                trace_add_open_close_event(td, f->fileno, FIO_LOG_CLOSE_FILE);
        }
 
        fifo_free(fifo);
        close(fd);
 
+       td_restore_runstate(td, old_state);
+
+       if (!td->files_index) {
+               log_err("fio: did not find replay device(s)\n");
+               return 1;
+       }
+
        if (skipped_writes)
                log_err("fio: %s skips replay of %lu writes due to read-only\n",
                                                td->o.name, skipped_writes);