Fio typically just makes up a filename for a job, but sometimes you want
to explicitly reuse the same file for multiple jobs. Add a filename=
option to cater to that.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
temp_stall_ts = 1;
fprintf(f_out, "%s: Laying out IO file(s) (%d x %LuMiB == %LuMiB)\n",
temp_stall_ts = 1;
fprintf(f_out, "%s: Laying out IO file(s) (%d x %LuMiB == %LuMiB)\n",
- td->name, td->nr_files,
- (td->total_file_size >> 20) / td->nr_files,
+ td->name, td->nr_uniq_files,
+ (td->total_file_size >> 20) / td->nr_uniq_files,
td->total_file_size >> 20);
err = 0;
td->total_file_size >> 20);
err = 0;
struct thread_data {
char name[32];
char *directory;
struct thread_data {
char name[32];
char *directory;
char verror[80];
pthread_t thread;
int thread_number;
char verror[80];
pthread_t thread;
int thread_number;
enum fio_filetype filetype;
struct fio_file *files;
unsigned int nr_files;
enum fio_filetype filetype;
struct fio_file *files;
unsigned int nr_files;
+ unsigned int nr_uniq_files;
unsigned int next_file;
int error;
pid_t pid;
unsigned int next_file;
int error;
pid_t pid;
if (td->odirect)
td->io_ops->flags |= FIO_RAWIO;
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;
char tmp[PATH_MAX];
int len = 0;
int i;
f->fd = -1;
f->fileno = i;
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 {
f->file_name = strdup(tmp);
}
} else {
fgetpos(f, &off);
continue;
}
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);
if (!check_strstore(p, "name", tmpbuf)) {
snprintf(td->name, sizeof(td->name)-1, "%s%d", tmpbuf, td->thread_number);
fgetpos(f, &off);