Normal vs special files fixups
authorJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 10:52:47 +0000 (11:52 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 13 Mar 2007 10:52:47 +0000 (11:52 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
fio.h
init.c

index 919bdf49504eebdc4b69c1643bf128c9001cbac2..4beb06e369c5061a364ed052d791c73fa2a99057 100644 (file)
@@ -101,8 +101,13 @@ static int create_files(struct thread_data *td)
        int err, need_create, can_extend;
        unsigned int i;
 
        int err, need_create, can_extend;
        unsigned int i;
 
-       for_each_file(td, f, i)
-               f->file_size = td->total_file_size / td->nr_files;
+       for_each_file(td, f, i) {
+               if (f->filetype != FIO_TYPE_FILE)
+                       continue;
+
+               f->file_size = td->total_file_size / td->nr_normal_files;
+               f->file_offset = td->start_offset;
+       }
 
        /*
         * unless specifically asked for overwrite, let normal io extend it
 
        /*
         * unless specifically asked for overwrite, let normal io extend it
@@ -139,8 +144,8 @@ static int create_files(struct thread_data *td)
 
        temp_stall_ts = 1;
        fprintf(f_out, "%s: Laying out IO file(s) (%u x %LuMiB == %LuMiB)\n",
 
        temp_stall_ts = 1;
        fprintf(f_out, "%s: Laying out IO file(s) (%u x %LuMiB == %LuMiB)\n",
-                               td->name, td->nr_uniq_files,
-                               (td->total_file_size >> 20) / td->nr_uniq_files,
+                               td->name, td->nr_normal_files,
+                               (td->total_file_size >> 20) / td->nr_normal_files,
                                td->total_file_size >> 20);
 
        err = 0;
                                td->total_file_size >> 20);
 
        err = 0;
@@ -444,7 +449,8 @@ void add_file(struct thread_data *td, const char *fname)
        get_file_type(f);
 
        td->open_files++;
        get_file_type(f);
 
        td->open_files++;
-       td->nr_uniq_files = td->open_files;
+       if (f->filetype == FIO_TYPE_FILE)
+               td->nr_normal_files++;
 }
 
 void get_file(struct fio_file *f)
 }
 
 void get_file(struct fio_file *f)
diff --git a/fio.h b/fio.h
index c5764c8f4f0d977ce10323c75db514d23d4755dc..3e8b2d2a84b62d119279a3c3501afcaecd441c8f 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -325,7 +325,7 @@ struct thread_data {
        struct fio_file *files;
        unsigned int nr_files;
        unsigned int nr_open_files;
        struct fio_file *files;
        unsigned int nr_files;
        unsigned int nr_open_files;
-       unsigned int nr_uniq_files;
+       unsigned int nr_normal_files;
        union {
                unsigned int next_file;
                os_random_state_t next_file_state;
        union {
                unsigned int next_file;
                os_random_state_t next_file_state;
diff --git a/init.c b/init.c
index 888e68b67137f95f5763d232992e07790d2ceaa9..a3d1d5a87e9fe1c0b7d87d2e0b49a0a744989f53 100644 (file)
--- a/init.c
+++ b/init.c
@@ -849,9 +849,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                        sprintf(fname, "%s/%s", td->directory, f->file_name);
                        f->file_name = strdup(fname);
                }
                        sprintf(fname, "%s/%s", td->directory, f->file_name);
                        f->file_name = strdup(fname);
                }
-
-               f->file_size = td->total_file_size / td->nr_files;
-               f->file_offset = td->start_offset;
        }
                
        td->mutex = fio_sem_init(0);
        }
                
        td->mutex = fio_sem_init(0);
@@ -1109,7 +1106,9 @@ static int str_filename_cb(void *data, const char *input)
        struct thread_data *td = data;
        char *fname, *str, *p;
 
        struct thread_data *td = data;
        char *fname, *str, *p;
 
-       td->nr_files = 0;
+       if (!td->filename)
+               td->nr_files = 0;
+
        p = str = strdup(input);
 
        strip_blank_front(&str);
        p = str = strdup(input);
 
        strip_blank_front(&str);