summaryrefslogtreecommitdiff
path: root/fs/aufs/wkq.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/aufs/wkq.h')
-rw-r--r--fs/aufs/wkq.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/aufs/wkq.h b/fs/aufs/wkq.h
index 752b9c52d..6d63f7464 100644
--- a/fs/aufs/wkq.h
+++ b/fs/aufs/wkq.h
@@ -12,6 +12,8 @@
#ifdef __KERNEL__
+#include <linux/percpu_counter.h>
+
struct super_block;
/* ---------------------------------------------------------------------- */
@@ -20,7 +22,7 @@ struct super_block;
* in the next operation, wait for the 'nowait' tasks in system-wide workqueue
*/
struct au_nowait_tasks {
- struct percpu_counter nw_len;
+ atomic_t nw_len;
wait_queue_head_t nw_wq;
};
@@ -47,7 +49,6 @@ int au_wkq_do_wait(unsigned int flags, au_wkq_func_t func, void *args);
int au_wkq_nowait(au_wkq_func_t func, void *args, struct super_block *sb,
unsigned int flags);
void au_nwt_init(struct au_nowait_tasks *nwt);
-void au_nwt_fin(struct au_nowait_tasks *nwt);
int __init au_wkq_init(void);
void au_wkq_fin(void);
@@ -65,14 +66,13 @@ static inline int au_wkq_wait(au_wkq_func_t func, void *args)
static inline void au_nwt_done(struct au_nowait_tasks *nwt)
{
- percpu_counter_dec(&nwt->nw_len);
- if (!percpu_counter_sum(&nwt->nw_len))
+ if (atomic_dec_and_test(&nwt->nw_len))
wake_up_all(&nwt->nw_wq);
}
static inline int au_nwt_flush(struct au_nowait_tasks *nwt)
{
- wait_event(nwt->nw_wq, !percpu_counter_sum(&nwt->nw_len));
+ wait_event(nwt->nw_wq, !atomic_read(&nwt->nw_len));
return 0;
}