diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-07-28 15:56:02 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 16:50:40 +0100 |
commit | b5043c5e2ca0de11a22e02cd8835c9489f833722 (patch) | |
tree | 337175f55d4e53b9d11f1b521234934d035ffbb9 /drivers/block/drbd/drbd_main.c | |
parent | 84b8c06b6591e73250e6ab4834a02a86c8994b91 (diff) | |
download | talos-obmc-linux-b5043c5e2ca0de11a22e02cd8835c9489f833722.tar.gz talos-obmc-linux-b5043c5e2ca0de11a22e02cd8835c9489f833722.zip |
drbd: Turn conn_flush_workqueue() into drbd_flush_workqueue()
The new function can flush any work queue, not just the work queue of the data
socket of a connection.
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index ada1b07c564e..232cd570d3ae 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -2397,6 +2397,30 @@ static void drbd_init_workqueue(struct drbd_work_queue* wq) init_waitqueue_head(&wq->q_wait); } +struct completion_work { + struct drbd_work w; + struct completion done; +}; + +static int w_complete(struct drbd_work *w, int cancel) +{ + struct completion_work *completion_work = + container_of(w, struct completion_work, w); + + complete(&completion_work->done); + return 0; +} + +void drbd_flush_workqueue(struct drbd_work_queue *work_queue) +{ + struct completion_work completion_work; + + completion_work.w.cb = w_complete; + init_completion(&completion_work.done); + drbd_queue_work(work_queue, &completion_work.w); + wait_for_completion(&completion_work.done); +} + struct drbd_resource *drbd_find_resource(const char *name) { struct drbd_resource *resource; |