X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=flow.c;h=a8dbfb9bb48e66a991953810d2c25d92eeeacb54;hp=384187ef0a59095d7754c6435132afe00ef9fd09;hb=fc220349e45144360917db48010b503a9874930d;hpb=c13a60ce72aaf5b07b93977ab86e7522d167ec28 diff --git a/flow.c b/flow.c index 384187ef..a8dbfb9b 100644 --- a/flow.c +++ b/flow.c @@ -1,5 +1,5 @@ #include "fio.h" -#include "mutex.h" +#include "fio_sem.h" #include "smalloc.h" #include "flist.h" @@ -11,7 +11,7 @@ struct fio_flow { }; static struct flist_head *flow_list; -static struct fio_mutex *flow_lock; +static struct fio_sem *flow_lock; int flow_threshold_exceeded(struct thread_data *td) { @@ -49,7 +49,7 @@ static struct fio_flow *flow_get(unsigned int id) if (!flow_lock) return NULL; - fio_mutex_down(flow_lock); + fio_sem_down(flow_lock); flist_for_each(n, flow_list) { flow = flist_entry(n, struct fio_flow, list); @@ -62,7 +62,7 @@ static struct fio_flow *flow_get(unsigned int id) if (!flow) { flow = smalloc(sizeof(*flow)); if (!flow) { - fio_mutex_up(flow_lock); + fio_sem_up(flow_lock); return NULL; } flow->refs = 0; @@ -74,7 +74,7 @@ static struct fio_flow *flow_get(unsigned int id) } flow->refs++; - fio_mutex_up(flow_lock); + fio_sem_up(flow_lock); return flow; } @@ -83,14 +83,14 @@ static void flow_put(struct fio_flow *flow) if (!flow_lock) return; - fio_mutex_down(flow_lock); + fio_sem_down(flow_lock); if (!--flow->refs) { flist_del(&flow->list); sfree(flow); } - fio_mutex_up(flow_lock); + fio_sem_up(flow_lock); } void flow_init_job(struct thread_data *td) @@ -115,7 +115,7 @@ void flow_init(void) return; } - flow_lock = fio_mutex_init(FIO_MUTEX_UNLOCKED); + flow_lock = fio_sem_init(FIO_SEM_UNLOCKED); if (!flow_lock) { log_err("fio: failed to allocate flow lock\n"); sfree(flow_list); @@ -128,7 +128,7 @@ void flow_init(void) void flow_exit(void) { if (flow_lock) - fio_mutex_remove(flow_lock); + fio_sem_remove(flow_lock); if (flow_list) sfree(flow_list); }