X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fio.h;h=12cf3c9a686b4a389cacd4da13736d0a0d0d8bf8;hb=07739b57f09886b41323c605b0dbda7d2c12522b;hp=7f314defb83e303f64c6fd710ce8670f9901840c;hpb=de64df05bb69d38b7ecf548d9e15573b9010704a;p=fio.git diff --git a/fio.h b/fio.h index 7f314def..12cf3c9a 100644 --- a/fio.h +++ b/fio.h @@ -17,6 +17,7 @@ #include "crc32.h" #include "arch.h" #include "os.h" +#include "mutex.h" #ifdef FIO_HAVE_SYSLET #include "syslet.h" @@ -431,7 +432,7 @@ struct thread_data { unsigned long long io_bytes[2]; unsigned long long this_io_bytes[2]; unsigned long long zone_bytes; - volatile int mutex; + struct fio_sem *mutex; /* * State for random io, a bitmap of blocks done vs not done @@ -703,30 +704,6 @@ 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 *); -/* - * This is a pretty crappy semaphore implementation, but with the use that fio - * has (just signalling start/go conditions), it doesn't have to be better. - * Naturally this would not work for any type of contended semaphore or - * for real locking. - */ -static inline void fio_sem_init(volatile int *sem, int val) -{ - *sem = val; -} - -static inline void fio_sem_down(volatile int *sem) -{ - while (*sem == 0) - usleep(10000); - - (*sem)--; -} - -static inline void fio_sem_up(volatile int *sem) -{ - (*sem)++; -} - /* * If logging output to a file, stderr should go to both stderr and f_err */