diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/backing-dev-defs.h | 20 | ||||
-rw-r--r-- | include/linux/backing-dev.h | 2 |
2 files changed, 22 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 |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 35b31d176f74..02650b1253a2 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -44,6 +44,8 @@ void wb_start_background_writeback(struct bdi_writeback *wb); | |||
44 | void wb_workfn(struct work_struct *work); | 44 | void wb_workfn(struct work_struct *work); |
45 | void wb_wakeup_delayed(struct bdi_writeback *wb); | 45 | void wb_wakeup_delayed(struct bdi_writeback *wb); |
46 | 46 | ||
47 | void wb_wait_for_completion(struct wb_completion *done); | ||
48 | |||
47 | extern spinlock_t bdi_lock; | 49 | extern spinlock_t bdi_lock; |
48 | extern struct list_head bdi_list; | 50 | extern struct list_head bdi_list; |
49 | 51 | ||