summaryrefslogtreecommitdiffstats
path: root/include/linux/writeback.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/writeback.h')
-rw-r--r--include/linux/writeback.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 3b73e97ecfc7..6726b7e56beb 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -8,6 +8,7 @@
8#include <linux/workqueue.h> 8#include <linux/workqueue.h>
9#include <linux/fs.h> 9#include <linux/fs.h>
10#include <linux/flex_proportions.h> 10#include <linux/flex_proportions.h>
11#include <linux/backing-dev-defs.h>
11 12
12DECLARE_PER_CPU(int, dirty_throttle_leaks); 13DECLARE_PER_CPU(int, dirty_throttle_leaks);
13 14
@@ -173,6 +174,51 @@ static inline void wait_on_inode(struct inode *inode)
173 wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE); 174 wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE);
174} 175}
175 176
177#ifdef CONFIG_CGROUP_WRITEBACK
178
179void __inode_attach_wb(struct inode *inode, struct page *page);
180
181/**
182 * inode_attach_wb - associate an inode with its wb
183 * @inode: inode of interest
184 * @page: page being dirtied (may be NULL)
185 *
186 * If @inode doesn't have its wb, associate it with the wb matching the
187 * memcg of @page or, if @page is NULL, %current. May be called w/ or w/o
188 * @inode->i_lock.
189 */
190static inline void inode_attach_wb(struct inode *inode, struct page *page)
191{
192 if (!inode->i_wb)
193 __inode_attach_wb(inode, page);
194}
195
196/**
197 * inode_detach_wb - disassociate an inode from its wb
198 * @inode: inode of interest
199 *
200 * @inode is being freed. Detach from its wb.
201 */
202static inline void inode_detach_wb(struct inode *inode)
203{
204 if (inode->i_wb) {
205 wb_put(inode->i_wb);
206 inode->i_wb = NULL;
207 }
208}
209
210#else /* CONFIG_CGROUP_WRITEBACK */
211
212static inline void inode_attach_wb(struct inode *inode, struct page *page)
213{
214}
215
216static inline void inode_detach_wb(struct inode *inode)
217{
218}
219
220#endif /* CONFIG_CGROUP_WRITEBACK */
221
176/* 222/*
177 * mm/page-writeback.c 223 * mm/page-writeback.c
178 */ 224 */