diff options
Diffstat (limited to 'include/linux/backing-dev-defs.h')
-rw-r--r-- | include/linux/backing-dev-defs.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 6a1a8a314d85..8fb740178d5d 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h | |||
@@ -67,6 +67,26 @@ enum wb_reason { | |||
67 | WB_REASON_MAX, | 67 | WB_REASON_MAX, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct wb_completion { | ||
71 | atomic_t cnt; | ||
72 | wait_queue_head_t *waitq; | ||
73 | }; | ||
74 | |||
75 | #define __WB_COMPLETION_INIT(_waitq) \ | ||
76 | (struct wb_completion){ .cnt = ATOMIC_INIT(1), .waitq = (_waitq) } | ||
77 | |||
78 | /* | ||
79 | * If one wants to wait for one or more wb_writeback_works, each work's | ||
80 | * ->done should be set to a wb_completion defined using the following | ||
81 | * macro. Once all work items are issued with wb_queue_work(), the caller | ||
82 | * can wait for the completion of all using wb_wait_for_completion(). Work | ||
83 | * items which are waited upon aren't freed automatically on completion. | ||
84 | */ | ||
85 | #define WB_COMPLETION_INIT(bdi) __WB_COMPLETION_INIT(&(bdi)->wb_waitq) | ||
86 | |||
87 | #define DEFINE_WB_COMPLETION(cmpl, bdi) \ | ||
88 | struct wb_completion cmpl = WB_COMPLETION_INIT(bdi) | ||
89 | |||
70 | /* | 90 | /* |
71 | * For cgroup writeback, multiple wb's may map to the same blkcg. Those | 91 | * For cgroup writeback, multiple wb's may map to the same blkcg. Those |
72 | * wb's can operate mostly independently but should share the congested | 92 | * wb's can operate mostly independently but should share the congested |