X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.h;h=fb70b465bec4e1da83a9359b8d2dbe39d84d5c24;hp=477b19a437613fda8037b09a77ab705ab25eea5d;hb=122426daab0fbd2fce244ac018d737a8f302f974;hpb=f2bba1820a567ac00b09916239ac8feb125cead2 diff --git a/fio.h b/fio.h index 477b19a4..fb70b465 100644 --- a/fio.h +++ b/fio.h @@ -174,6 +174,7 @@ struct thread_options { unsigned int verify_pattern; unsigned int verify_pattern_bytes; unsigned int verify_fatal; + unsigned int verify_async; unsigned int use_thread; unsigned int unlink; unsigned int do_disk_util; @@ -192,6 +193,7 @@ struct thread_options { unsigned int thinktime_spin; unsigned int thinktime_blocks; unsigned int fsync_blocks; + unsigned int fdatasync_blocks; unsigned int start_delay; unsigned long long timeout; unsigned long long ramp_time; @@ -201,12 +203,15 @@ struct thread_options { unsigned long long zone_size; unsigned long long zone_skip; enum fio_memtype mem_type; + unsigned int mem_align; unsigned int stonewall; unsigned int new_group; unsigned int numjobs; os_cpu_mask_t cpumask; unsigned int cpumask_set; + os_cpu_mask_t verify_cpumask; + unsigned int verify_cpumask_set; unsigned int iolog; unsigned int rwmixcycle; unsigned int rwmix[2]; @@ -317,6 +322,17 @@ struct thread_data { struct flist_head io_u_freelist; struct flist_head io_u_busylist; struct flist_head io_u_requeues; + pthread_mutex_t io_u_lock; + pthread_cond_t free_cond; + + /* + * async verify offload + */ + struct flist_head verify_list; + pthread_t *verify_threads; + unsigned int nr_verify_threads; + pthread_cond_t verify_cond; + int verify_thread_exit; /* * Rate state @@ -446,7 +462,7 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u) #define MAX_JOBS (1024) -#define td_non_fatal_error(e) ((e) == -EIO || (e) == EILSEQ) +#define td_non_fatal_error(e) ((e) == EIO || (e) == EILSEQ) static inline void update_error_count(struct thread_data *td, int err) { @@ -654,4 +670,31 @@ static inline int should_check_rate(struct thread_data *td, return ret; } +static inline int is_power_of_2(unsigned int val) +{ + return (val != 0 && ((val & (val - 1)) == 0)); +} + +/* + * We currently only need to do locking if we have verifier threads + * accessing our internal structures too + */ +static inline void td_io_u_lock(struct thread_data *td) +{ + if (td->o.verify_async) + pthread_mutex_lock(&td->io_u_lock); +} + +static inline void td_io_u_unlock(struct thread_data *td) +{ + if (td->o.verify_async) + pthread_mutex_unlock(&td->io_u_lock); +} + +static inline void td_io_u_free_notify(struct thread_data *td) +{ + if (td->o.verify_async) + pthread_cond_signal(&td->free_cond); +} + #endif