[PATCH] Add option to specify the exact file used
[fio.git] / init.c
diff --git a/init.c b/init.c
index a0ab7d2261fa506c3ac1c47e3cf10c23d9f6e17b..e314d6c0a74067904e8beacc3f832a48085e2772 100644 (file)
--- a/init.c
+++ b/init.c
@@ -169,7 +169,12 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
        if (td->odirect)
                td->io_ops->flags |= FIO_RAWIO;
 
-       if (td->filetype == FIO_TYPE_FILE) {
+       if (td->filename)
+               td->nr_uniq_files = 1;
+       else
+               td->nr_uniq_files = td->nr_files;
+
+       if (td->filetype == FIO_TYPE_FILE || td->filename) {
                char tmp[PATH_MAX];
                int len = 0;
                int i;
@@ -184,7 +189,10 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                        f->fd = -1;
                        f->fileno = i;
 
-                       sprintf(tmp + len, "%s.%d.%d", jobname, td->thread_number, i);
+                       if (td->filename)
+                               sprintf(tmp + len, "%s", td->filename);
+                       else
+                               sprintf(tmp + len, "%s.%d.%d", jobname, td->thread_number, i);
                        f->file_name = strdup(tmp);
                }
        } else {
@@ -898,6 +906,11 @@ int parse_jobs_ini(char *file, int stonewall_flag)
                                fgetpos(f, &off);
                                continue;
                        }
+                       if (!check_strstore(p, "filename", tmpbuf)) {
+                               td->filename = strdup(tmpbuf);
+                               fgetpos(f, &off);
+                               continue;
+                       }
                        if (!check_strstore(p, "name", tmpbuf)) {
                                snprintf(td->name, sizeof(td->name)-1, "%s%d", tmpbuf, td->thread_number);
                                fgetpos(f, &off);