diff options
Diffstat (limited to 'include/linux/backing-dev-defs.h')
| -rw-r--r-- | include/linux/backing-dev-defs.h | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 6a1a8a314d85..4fc87dee005a 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -63,10 +63,31 @@ enum wb_reason {  	 * so it has a mismatch name.  	 */  	WB_REASON_FORKER_THREAD, +	WB_REASON_FOREIGN_FLUSH,  	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 @@ -165,6 +186,8 @@ struct bdi_writeback {  };  struct backing_dev_info { +	u64 id; +	struct rb_node rb_node; /* keyed by ->id */  	struct list_head bdi_list;  	unsigned long ra_pages;	/* max readahead in PAGE_SIZE units */  	unsigned long io_pages;	/* max allowed IO size */  |