X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fio.h;h=0cf5334ba8ef518a60356d9176646cbc5a8662f8;hb=refs%2Ftags%2Ffio-1.20-rc2;hp=fe1a227d317649f52398565881edbce715e7c998;hpb=392a374205d9e90fe4b4b6419fefa493f0a5ccc2;p=fio.git diff --git a/fio.h b/fio.h index fe1a227d..0cf5334b 100644 --- a/fio.h +++ b/fio.h @@ -46,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 */ @@ -309,6 +315,14 @@ struct fio_file { unsigned long long last_pos; + /* + * if io is protected by a semaphore, this is set + */ + struct fio_mutex *lock; + void *lock_owner; + unsigned int lock_batch; + enum fio_ddir lock_ddir; + /* * block map for random io */ @@ -407,6 +421,8 @@ struct thread_options { unsigned int nr_files; unsigned int open_files; + enum file_lock_mode file_lock_mode; + unsigned int lockfile_batch; unsigned int odirect; unsigned int invalidate_cache; @@ -810,8 +826,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 *); @@ -944,7 +961,9 @@ 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)++) + 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)) { \