X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.h;h=6f2c4c09810c3e1c379c8570db70384412ba274c;hp=ffd3d7d00a1252cc60ca1280269977a7f1f2b36e;hb=aec2de209564a6951e6c91d653fc99a75508607d;hpb=29c1349f1840c3f60434c9da602074bc8fde4afe diff --git a/fio.h b/fio.h index ffd3d7d0..6f2c4c09 100644 --- a/fio.h +++ b/fio.h @@ -22,7 +22,6 @@ #include "arch/arch.h" #include "os/os.h" #include "mutex.h" -#include "sem.h" #include "log.h" #include "debug.h" @@ -47,6 +46,12 @@ enum td_ddir { TD_DDIR_RANDRW = TD_DDIR_RW | TD_DDIR_RAND, }; +enum file_lock_mode { + FILE_LOCK_NONE, + FILE_LOCK_EXCLUSIVE, + FILE_LOCK_READWRITE, +}; + /* * Use for maintaining statistics */ @@ -313,9 +318,10 @@ struct fio_file { /* * if io is protected by a semaphore, this is set */ - struct fio_sem *sem; - void *sem_owner; - unsigned int sem_batch; + struct fio_mutex *lock; + void *lock_owner; + unsigned int lock_batch; + enum fio_ddir lock_ddir; /* * block map for random io @@ -415,7 +421,7 @@ struct thread_options { unsigned int nr_files; unsigned int open_files; - unsigned int lockfile; + enum file_lock_mode file_lock_mode; unsigned int lockfile_batch; unsigned int odirect; @@ -440,6 +446,7 @@ struct thread_options { unsigned int write_lat_log; unsigned int write_bw_log; unsigned int norandommap; + unsigned int softrandommap; unsigned int bs_unaligned; unsigned int fsync_on_close; @@ -591,8 +598,7 @@ struct thread_data { * read/write mixed workload state */ os_random_state_t rwmix_state; - unsigned long long rwmix_bytes; - struct timeval rwmix_switch; + unsigned long rwmix_issues; enum fio_ddir rwmix_ddir; unsigned int ddir_nr; @@ -677,6 +683,7 @@ extern unsigned long long mlock_size; extern unsigned long page_mask, page_size; extern int read_only; extern int eta_print; +extern unsigned long done_secs; extern char *job_section; extern struct thread_data *threads; @@ -685,6 +692,7 @@ extern struct thread_data *threads; #define td_write(td) ((td)->o.td_ddir & TD_DDIR_WRITE) #define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW) #define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND) +#define file_randommap(td, f) (!(td)->o.norandommap && (f)->file_map) static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u) { @@ -692,9 +700,9 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u) } #define BLOCKS_PER_MAP (8 * sizeof(long)) -#define TO_MAP_BLOCK(td, f, b) (b) -#define RAND_MAP_IDX(td, f, b) (TO_MAP_BLOCK(td, f, b) / BLOCKS_PER_MAP) -#define RAND_MAP_BIT(td, f, b) (TO_MAP_BLOCK(td, f, b) & (BLOCKS_PER_MAP - 1)) +#define TO_MAP_BLOCK(f, b) (b) +#define RAND_MAP_IDX(f, b) (TO_MAP_BLOCK(f, b) / BLOCKS_PER_MAP) +#define RAND_MAP_BIT(f, b) (TO_MAP_BLOCK(f, b) & (BLOCKS_PER_MAP - 1)) #define MAX_JOBS (1024) @@ -749,6 +757,7 @@ enum file_log_act { FIO_LOG_ADD_FILE, FIO_LOG_OPEN_FILE, FIO_LOG_CLOSE_FILE, + FIO_LOG_UNLINK_FILE, }; extern int __must_check read_iolog_get(struct thread_data *, struct io_u *); @@ -756,6 +765,7 @@ extern void log_io_u(struct thread_data *, struct io_u *); extern void log_file(struct thread_data *, struct fio_file *, enum file_log_act); extern int __must_check init_iolog(struct thread_data *td); extern void log_io_piece(struct thread_data *, struct io_u *); +extern void queue_io_piece(struct thread_data *, struct io_piece *); extern void prune_io_piece_log(struct thread_data *); extern void write_iolog_close(struct thread_data *); @@ -820,8 +830,9 @@ 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 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 void lock_file(struct thread_data *, struct fio_file *, enum fio_ddir); +extern void unlock_file(struct thread_data *, struct fio_file *); +extern void unlock_file_all(struct thread_data *, 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 *); @@ -954,7 +965,10 @@ extern void close_ioengine(struct thread_data *); #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)++) + if ((td)->files_index) \ + for ((i) = 0, (f) = (td)->files[0]; \ + (i) < (td)->o.nr_files && ((f) = (td)->files[i]) != NULL; \ + (i)++) #define fio_assert(td, cond) do { \ if (!(cond)) { \