From 1549441cdfecb2c1a4a8b8d494253859d67b4344 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 13 Mar 2007 11:52:47 +0100 Subject: [PATCH] Normal vs special files fixups Signed-off-by: Jens Axboe --- filesetup.c | 16 +++++++++++----- fio.h | 2 +- init.c | 7 +++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/filesetup.c b/filesetup.c index 919bdf49..4beb06e3 100644 --- a/filesetup.c +++ b/filesetup.c @@ -101,8 +101,13 @@ static int create_files(struct thread_data *td) 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 @@ -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", - 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; @@ -444,7 +449,8 @@ void add_file(struct thread_data *td, const char *fname) 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) diff --git a/fio.h b/fio.h index c5764c8f..3e8b2d2a 100644 --- 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; - unsigned int nr_uniq_files; + unsigned int nr_normal_files; union { unsigned int next_file; os_random_state_t next_file_state; diff --git a/init.c b/init.c index 888e68b6..a3d1d5a8 100644 --- 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); } - - f->file_size = td->total_file_size / td->nr_files; - f->file_offset = td->start_offset; } 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; - td->nr_files = 0; + if (!td->filename) + td->nr_files = 0; + p = str = strdup(input); strip_blank_front(&str); -- 2.25.1