wb_completion is used to track writeback completions. We want to use it from memcg side for foreign inode flushes. This patch updates it to remember the target waitq instead of assuming bdi->wb_waitq and expose it outside of fs-writeback.c.
Showing the changes to include/linux (2 of 3 files). Show all
Unified · Split
| @@ -67,6 +67,26 @@ enum wb_reason { · 66 unmodified lines | |||
| 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 |
| @@ -44,6 +44,8 @@ void wb_start_background_writeback(struct bdi_writeback *wb); · 43 unmodified lines | |||
| 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 | ||