#include "arch/arch.h"
#include "os/os.h"
#include "mutex.h"
+#include "sem.h"
#include "log.h"
#include "debug.h"
FIO_FILE_EXTEND = 1 << 2, /* needs extend */
FIO_FILE_DONE = 1 << 3, /* io completed to this file */
FIO_SIZE_KNOWN = 1 << 4, /* size has been set */
+ FIO_FILE_HASHED = 1 << 5, /* file is on hash */
};
/*
* this structure holds state information for a single file.
*/
struct fio_file {
+ struct list_head hash_list;
enum fio_filetype filetype;
/*
unsigned long long io_size;
unsigned long long last_pos;
- unsigned long long last_completed_pos;
+
+ /*
+ * if io is protected by a semaphore, this is set
+ */
+ struct fio_sem *sem;
+ void *sem_owner;
+ unsigned int sem_batch;
/*
* block map for random io
unsigned int nr_files;
unsigned int open_files;
+ unsigned int lockfile;
+ unsigned int lockfile_batch;
unsigned int odirect;
unsigned int invalidate_cache;
int thread_number;
int groupid;
struct thread_stat ts;
- struct fio_file *files;
+ struct fio_file **files;
unsigned int files_index;
unsigned int nr_open_files;
unsigned int nr_done_files;
* File setup/shutdown
*/
extern void close_files(struct thread_data *);
+extern void close_and_free_files(struct thread_data *);
extern int __must_check setup_files(struct thread_data *);
extern int __must_check open_files(struct thread_data *);
extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_file *);
extern int __must_check generic_open_file(struct thread_data *, struct fio_file *);
-extern void generic_close_file(struct thread_data *, struct fio_file *);
+extern int __must_check generic_close_file(struct thread_data *, struct fio_file *);
extern int add_file(struct thread_data *, const char *);
extern void get_file(struct fio_file *);
-extern void put_file(struct thread_data *, struct fio_file *);
+extern int __must_check put_file(struct thread_data *, struct fio_file *);
+extern void lock_file(struct thread_data *, struct fio_file *);
+extern void unlock_file(struct fio_file *);
extern int add_dir_files(struct thread_data *, const char *);
extern int init_random_map(struct thread_data *);
extern void dup_files(struct thread_data *, struct thread_data *);
extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
extern int __must_check td_io_commit(struct thread_data *);
extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
-extern void td_io_close_file(struct thread_data *, struct fio_file *);
+extern int td_io_close_file(struct thread_data *, struct fio_file *);
/*
* blktrace support
int (*cancel)(struct thread_data *, struct io_u *);
void (*cleanup)(struct thread_data *);
int (*open_file)(struct thread_data *, struct fio_file *);
- void (*close_file)(struct thread_data *, struct fio_file *);
+ int (*close_file)(struct thread_data *, struct fio_file *);
void *data;
void *dlhandle;
};
-#define FIO_IOOPS_VERSION 8
+#define FIO_IOOPS_VERSION 9
extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
extern void register_ioengine(struct ioengine_ops *);
#define for_each_td(td, i) \
for ((i) = 0, (td) = &threads[0]; (i) < (int) thread_number; (i)++, (td)++)
#define for_each_file(td, f, i) \
- for ((i) = 0, (f) = &(td)->files[0]; (i) < (td)->o.nr_files; (i)++, (f)++)
+ for ((i) = 0, (f) = (td)->files[0]; (i) < (td)->o.nr_files; (i)++, (f)++)
#define fio_assert(td, cond) do { \
if (!(cond)) { \