dprint(FD_BLKTRACE, "add devices %s\n", dev);
fileno = add_file_exclusive(td, dev);
+ td->files[fileno]->major = maj;
+ td->files[fileno]->minor = min;
trace_add_open_close_event(td, fileno, FIO_LOG_OPEN_FILE);
last_fileno = fileno;
}
unsigned int cpu;
unsigned int rw_bs[2];
struct fifo *fifo;
- int fd, i;
+ int fd, i, old_state;
struct fio_file *f;
fd = open(filename, O_RDONLY);
fifo = fifo_alloc(TRACE_FIFO_SIZE);
+ old_state = td->runstate;
+ td_set_runstate(td, TD_SETTING_UP);
+
td->o.size = 0;
cpu = 0;
fifo_free(fifo);
close(fd);
+ td_set_runstate(td, old_state);
+
if (!td->files_index) {
log_err("fio: did not find replay device(s)\n");
return 1;
struct netio_data *nd;
if (!td->files_index) {
- add_file(td, td->o.filename ?: "net", 0);
+ add_file(td, td->o.filename ?: "net", 0, 0);
td->o.nr_files = td->o.nr_files ?: 1;
}
* The size of the RBD is set instead of a artificial file.
*/
if (!td->files_index) {
- add_file(td, td->o.filename ? : "rbd", 0);
+ add_file(td, td->o.filename ? : "rbd", 0, 0);
td->o.nr_files = td->o.nr_files ? : 1;
}
f = td->files[0];
extern int __must_check generic_get_file_size(struct thread_data *, struct fio_file *);
extern int __must_check file_lookup_open(struct fio_file *f, int flags);
extern int __must_check pre_read_files(struct thread_data *);
-extern int add_file(struct thread_data *, const char *, int);
+extern int add_file(struct thread_data *, const char *, int, int);
extern int add_file_exclusive(struct thread_data *, const char *);
extern void get_file(struct fio_file *);
extern int __must_check put_file(struct thread_data *, struct fio_file *);
}
}
-int add_file(struct thread_data *td, const char *fname, int numjob)
+int add_file(struct thread_data *td, const char *fname, int numjob, int inc)
{
int cur_files = td->files_index;
char file_name[PATH_MAX];
if (!td->o.open_files)
td->o.open_files = 1;
+ if (inc)
+ td->o.nr_files++;
+
dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name,
cur_files);
return i;
}
- return add_file(td, fname, 0);
+ return add_file(td, fname, 0, 1);
}
void get_file(struct fio_file *f)
}
if (S_ISREG(sb.st_mode)) {
- add_file(td, full_path, 0);
- td->o.nr_files++;
+ add_file(td, full_path, 0, 1);
continue;
}
if (!S_ISDIR(sb.st_mode))
file_alloced = 1;
if (o->nr_files == 1 && exists_and_not_file(jobname))
- add_file(td, jobname, job_add_num);
+ add_file(td, jobname, job_add_num, 0);
else {
for (i = 0; i < o->nr_files; i++)
- add_file(td, make_filename(fname, o, jobname, job_add_num, i), job_add_num);
+ add_file(td, make_filename(fname, o, jobname, job_add_num, i), job_add_num, 0);
}
}
} else if (r == 2) {
rw = DDIR_INVAL;
if (!strcmp(act, "add")) {
- td->o.nr_files++;
- fileno = add_file(td, fname, 0);
+ fileno = add_file(td, fname, 0, 1);
file_action = FIO_LOG_ADD_FILE;
continue;
} else if (!strcmp(act, "open")) {
while ((fname = get_next_name(&str)) != NULL) {
if (!strlen(fname))
break;
- add_file(td, fname, 0);
- td->o.nr_files++;
+ add_file(td, fname, 0, 1);
}
free(p);