mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
writeback: Generalize and expose wb_completion
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. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
38b4e09fbc
commit
5b9cce4c7e
3 changed files with 36 additions and 33 deletions
|
@ -67,6 +67,26 @@ enum wb_reason {
|
|||
WB_REASON_MAX,
|
||||
};
|
||||
|
||||
struct wb_completion {
|
||||
atomic_t cnt;
|
||||
wait_queue_head_t *waitq;
|
||||
};
|
||||
|
||||
#define __WB_COMPLETION_INIT(_waitq) \
|
||||
(struct wb_completion){ .cnt = ATOMIC_INIT(1), .waitq = (_waitq) }
|
||||
|
||||
/*
|
||||
* If one wants to wait for one or more wb_writeback_works, each work's
|
||||
* ->done should be set to a wb_completion defined using the following
|
||||
* macro. Once all work items are issued with wb_queue_work(), the caller
|
||||
* can wait for the completion of all using wb_wait_for_completion(). Work
|
||||
* items which are waited upon aren't freed automatically on completion.
|
||||
*/
|
||||
#define WB_COMPLETION_INIT(bdi) __WB_COMPLETION_INIT(&(bdi)->wb_waitq)
|
||||
|
||||
#define DEFINE_WB_COMPLETION(cmpl, bdi) \
|
||||
struct wb_completion cmpl = WB_COMPLETION_INIT(bdi)
|
||||
|
||||
/*
|
||||
* For cgroup writeback, multiple wb's may map to the same blkcg. Those
|
||||
* wb's can operate mostly independently but should share the congested
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue