blktrace: load improvements
- Set the state explicitly to SETTING_UP when loading the
traces. This could take a while, so tell the status thread
that we are setting up so it knows how to display us
correctly.
- Fix a bug with multiple devices where we didn't cache the
major/minor properly. This made blktrace spend tons of CPU
cycles looking up /sys.
- Handle multiple devices correctly when adding files.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/filesetup.c b/filesetup.c
index 7669d70..1acf6ad 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -1145,7 +1145,7 @@
}
}
-int add_file(struct thread_data *td, const char *fname, int numjob)
+int add_file(struct thread_data *td, const char *fname, int numjob, int inc)
{
int cur_files = td->files_index;
char file_name[PATH_MAX];
@@ -1237,6 +1237,9 @@
if (!td->o.open_files)
td->o.open_files = 1;
+ if (inc)
+ td->o.nr_files++;
+
dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name,
cur_files);
@@ -1253,7 +1256,7 @@
return i;
}
- return add_file(td, fname, 0);
+ return add_file(td, fname, 0, 1);
}
void get_file(struct fio_file *f)
@@ -1362,8 +1365,7 @@
}
if (S_ISREG(sb.st_mode)) {
- add_file(td, full_path, 0);
- td->o.nr_files++;
+ add_file(td, full_path, 0, 1);
continue;
}
if (!S_ISDIR(sb.st_mode))