Init stat for all files, not just current range
authorJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 11:51:40 +0000 (12:51 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 11:51:40 +0000 (12:51 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
fio.h
stat.c

index 4beb06e369c5061a364ed052d791c73fa2a99057..c1107a42eb6f098a78a5e48cc25bfaae889df3fd 100644 (file)
@@ -436,7 +436,7 @@ static void get_file_type(struct fio_file *f)
 
 void add_file(struct thread_data *td, const char *fname)
 {
-       int cur_files = td->open_files;
+       int cur_files = td->files_index;
        struct fio_file *f;
 
        td->files = realloc(td->files, (cur_files + 1) * sizeof(*f));
@@ -448,7 +448,7 @@ void add_file(struct thread_data *td, const char *fname)
 
        get_file_type(f);
 
-       td->open_files++;
+       td->files_index++;
        if (f->filetype == FIO_TYPE_FILE)
                td->nr_normal_files++;
 }
diff --git a/fio.h b/fio.h
index 3e8b2d2a84b62d119279a3c3501afcaecd441c8f..465053ac675372e8c9a854af4cb7edba974b1b73 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -323,6 +323,7 @@ struct thread_data {
        int groupid;
        struct thread_stat ts;
        struct fio_file *files;
+       unsigned int files_index;
        unsigned int nr_files;
        unsigned int nr_open_files;
        unsigned int nr_normal_files;
@@ -775,6 +776,8 @@ extern void close_ioengine(struct thread_data *);
        for ((i) = 0, (td) = &threads[0]; (i) < (int) thread_number; (i)++, (td)++)
 #define for_each_file(td, f, i)        \
        for ((i) = 0, (f) = &(td)->files[0]; (i) < (td)->open_files; (i)++, (f)++)
+#define for_all_files(td, f, i)        \
+       for ((i) = 0, (f) = &(td)->files[0]; (i) < (td)->files_index; (i)++, (f)++)
 
 #define fio_assert(td, cond)   do {    \
        if (!(cond)) {                  \
diff --git a/stat.c b/stat.c
index 815e3ae54fd42f01200614db771c5768cf004147..ed1db7c90cbcf3fd5b55212d3eae37b84226782b 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -317,7 +317,7 @@ void init_disk_util(struct thread_data *td)
            (td->io_ops->flags & (FIO_DISKLESSIO | FIO_NODISKUTIL)))
                return;
 
-       for_each_file(td, f, i)
+       for_all_files(td, f, i)
                __init_disk_util(td, f);
 }