int fileno;
dprint(FD_BLKTRACE, "add devices %s\n", dev);
- fileno = add_file(td, dev);
+ fileno = add_file_exclusive(td, dev);
trace_add_open_event(td, fileno);
}
}
extern int __must_check generic_get_file_size(struct thread_data *, struct fio_file *);
extern int __must_check pre_read_files(struct thread_data *);
extern int add_file(struct thread_data *, const char *);
+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 *);
extern void put_file_log(struct thread_data *, struct fio_file *);
return cur_files;
}
+int add_file_exclusive(struct thread_data *td, const char *fname)
+{
+ struct fio_file *f;
+ unsigned int i;
+
+ for_each_file(td, f, i) {
+ if (!strcmp(f->file_name, fname))
+ return i;
+ }
+
+ return add_file(td, fname);
+}
+
void get_file(struct fio_file *f)
{
dprint(FD_FILE, "get file %s, ref=%d\n", f->file_name, f->references);
io_u->buflen = ipo->len;
io_u->file = td->files[ipo->fileno];
get_file(io_u->file);
-
dprint(FD_IO, "iolog: get %llu/%lu/%s\n", io_u->offset,
io_u->buflen, io_u->file->file_name);
if (ipo->delay) iolog_delay(td, ipo->delay);