1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds * include/linux/backing-dev.h
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds * low-level device information and state which is propagated up through
61da177e4SLinus Torvalds * to high-level code.
71da177e4SLinus Torvalds */
81da177e4SLinus Torvalds
91da177e4SLinus Torvalds #ifndef _LINUX_BACKING_DEV_H
101da177e4SLinus Torvalds #define _LINUX_BACKING_DEV_H
111da177e4SLinus Torvalds
12cf0ca9feSPeter Zijlstra #include <linux/kernel.h>
13e4ad08feSMiklos Szeredi #include <linux/fs.h>
1403ba3782SJens Axboe #include <linux/sched.h>
1568f23b89STheodore Ts'o #include <linux/device.h>
1603ba3782SJens Axboe #include <linux/writeback.h>
1766114cadSTejun Heo #include <linux/backing-dev-defs.h>
18a13f35e8STejun Heo #include <linux/slab.h>
19de1414a6SChristoph Hellwig
bdi_get(struct backing_dev_info * bdi)20d03f6cdcSJan Kara static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi)
21d03f6cdcSJan Kara {
22d03f6cdcSJan Kara kref_get(&bdi->refcnt);
23d03f6cdcSJan Kara return bdi;
24d03f6cdcSJan Kara }
25d03f6cdcSJan Kara
2634f8fe50STejun Heo struct backing_dev_info *bdi_get_by_id(u64 id);
27d03f6cdcSJan Kara void bdi_put(struct backing_dev_info *bdi);
28b2e8fb6eSPeter Zijlstra
297c4cc300SJan Kara __printf(2, 3)
307c4cc300SJan Kara int bdi_register(struct backing_dev_info *bdi, const char *fmt, ...);
31a93f00b3SMathieu Malaterre __printf(2, 0)
327c4cc300SJan Kara int bdi_register_va(struct backing_dev_info *bdi, const char *fmt,
337c4cc300SJan Kara va_list args);
343c5d202bSChristoph Hellwig void bdi_set_owner(struct backing_dev_info *bdi, struct device *owner);
35b02176f3STejun Heo void bdi_unregister(struct backing_dev_info *bdi);
36b02176f3STejun Heo
37aef33c2fSChristoph Hellwig struct backing_dev_info *bdi_alloc(int node_id);
38b02176f3STejun Heo
399ecf4866STejun Heo void wb_start_background_writeback(struct bdi_writeback *wb);
40f0054bb1STejun Heo void wb_workfn(struct work_struct *work);
41cf0ca9feSPeter Zijlstra
425b9cce4cSTejun Heo void wb_wait_for_completion(struct wb_completion *done);
435b9cce4cSTejun Heo
4403ba3782SJens Axboe extern spinlock_t bdi_lock;
4566f3b8e2SJens Axboe extern struct list_head bdi_list;
4666f3b8e2SJens Axboe
47839a8e86STejun Heo extern struct workqueue_struct *bdi_wq;
48839a8e86STejun Heo
wb_has_dirty_io(struct bdi_writeback * wb)49d6c10f1fSTejun Heo static inline bool wb_has_dirty_io(struct bdi_writeback *wb)
5003ba3782SJens Axboe {
51d6c10f1fSTejun Heo return test_bit(WB_has_dirty_io, &wb->state);
5203ba3782SJens Axboe }
5303ba3782SJens Axboe
bdi_has_dirty_io(struct backing_dev_info * bdi)5495a46c65STejun Heo static inline bool bdi_has_dirty_io(struct backing_dev_info *bdi)
55e0bf68ddSPeter Zijlstra {
5695a46c65STejun Heo /*
5795a46c65STejun Heo * @bdi->tot_write_bandwidth is guaranteed to be > 0 if there are
5895a46c65STejun Heo * any dirty wbs. See wb_update_write_bandwidth().
5995a46c65STejun Heo */
6095a46c65STejun Heo return atomic_long_read(&bdi->tot_write_bandwidth);
61e0bf68ddSPeter Zijlstra }
62e0bf68ddSPeter Zijlstra
wb_stat_mod(struct bdi_writeback * wb,enum wb_stat_item item,s64 amount)63bd3488e7SMatthew Wilcox (Oracle) static inline void wb_stat_mod(struct bdi_writeback *wb,
6493f78d88STejun Heo enum wb_stat_item item, s64 amount)
65e0bf68ddSPeter Zijlstra {
66104b4e51SNikolay Borisov percpu_counter_add_batch(&wb->stat[item], amount, WB_STAT_BATCH);
67b2e8fb6eSPeter Zijlstra }
68b2e8fb6eSPeter Zijlstra
inc_wb_stat(struct bdi_writeback * wb,enum wb_stat_item item)693e8f399dSNikolay Borisov static inline void inc_wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
70e0bf68ddSPeter Zijlstra {
71bd3488e7SMatthew Wilcox (Oracle) wb_stat_mod(wb, item, 1);
72b2e8fb6eSPeter Zijlstra }
73b2e8fb6eSPeter Zijlstra
dec_wb_stat(struct bdi_writeback * wb,enum wb_stat_item item)7493f78d88STejun Heo static inline void dec_wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
75b2e8fb6eSPeter Zijlstra {
76bd3488e7SMatthew Wilcox (Oracle) wb_stat_mod(wb, item, -1);
77b2e8fb6eSPeter Zijlstra }
78b2e8fb6eSPeter Zijlstra
wb_stat(struct bdi_writeback * wb,enum wb_stat_item item)7993f78d88STejun Heo static inline s64 wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
80b2e8fb6eSPeter Zijlstra {
8193f78d88STejun Heo return percpu_counter_read_positive(&wb->stat[item]);
82b2e8fb6eSPeter Zijlstra }
83b2e8fb6eSPeter Zijlstra
wb_stat_sum(struct bdi_writeback * wb,enum wb_stat_item item)8493f78d88STejun Heo static inline s64 wb_stat_sum(struct bdi_writeback *wb, enum wb_stat_item item)
85b2e8fb6eSPeter Zijlstra {
86e3d3910aSNikolay Borisov return percpu_counter_sum_positive(&wb->stat[item]);
87b2e8fb6eSPeter Zijlstra }
88b2e8fb6eSPeter Zijlstra
8993f78d88STejun Heo extern void wb_writeout_inc(struct bdi_writeback *wb);
90dd5656e5SMiklos Szeredi
91b2e8fb6eSPeter Zijlstra /*
92b2e8fb6eSPeter Zijlstra * maximal error of a stat counter.
93b2e8fb6eSPeter Zijlstra */
wb_stat_error(void)942bce774eSWang Long static inline unsigned long wb_stat_error(void)
95b2e8fb6eSPeter Zijlstra {
96b2e8fb6eSPeter Zijlstra #ifdef CONFIG_SMP
9793f78d88STejun Heo return nr_cpu_ids * WB_STAT_BATCH;
98b2e8fb6eSPeter Zijlstra #else
99b2e8fb6eSPeter Zijlstra return 1;
100b2e8fb6eSPeter Zijlstra #endif
101e0bf68ddSPeter Zijlstra }
1021da177e4SLinus Torvalds
103ae82291eSStefan Roesch /* BDI ratio is expressed as part per 1000000 for finer granularity. */
104ae82291eSStefan Roesch #define BDI_RATIO_SCALE 10000
105ae82291eSStefan Roesch
106712c00d6SStefan Roesch u64 bdi_get_min_bytes(struct backing_dev_info *bdi);
10700df7d51SStefan Roesch u64 bdi_get_max_bytes(struct backing_dev_info *bdi);
108189d3c4aSPeter Zijlstra int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio);
109a42dde04SPeter Zijlstra int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
1102c44af4fSStefan Roesch int bdi_set_min_ratio_no_scale(struct backing_dev_info *bdi, unsigned int min_ratio);
1114e230b40SStefan Roesch int bdi_set_max_ratio_no_scale(struct backing_dev_info *bdi, unsigned int max_ratio);
112803c9805SStefan Roesch int bdi_set_min_bytes(struct backing_dev_info *bdi, u64 min_bytes);
1131bf27e98SStefan Roesch int bdi_set_max_bytes(struct backing_dev_info *bdi, u64 max_bytes);
1148e9d5eadSStefan Roesch int bdi_set_strict_limit(struct backing_dev_info *bdi, unsigned int strict_limit);
115189d3c4aSPeter Zijlstra
1161da177e4SLinus Torvalds /*
1171da177e4SLinus Torvalds * Flags in backing_dev_info::capability
118e4ad08feSMiklos Szeredi *
119f56753acSChristoph Hellwig * BDI_CAP_WRITEBACK: Supports dirty page writeback, and dirty pages
120f56753acSChristoph Hellwig * should contribute to accounting
121823423efSChristoph Hellwig * BDI_CAP_WRITEBACK_ACCT: Automatically account writeback pages
122f56753acSChristoph Hellwig * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold
1231da177e4SLinus Torvalds */
124f56753acSChristoph Hellwig #define BDI_CAP_WRITEBACK (1 << 0)
125f56753acSChristoph Hellwig #define BDI_CAP_WRITEBACK_ACCT (1 << 1)
126f56753acSChristoph Hellwig #define BDI_CAP_STRICTLIMIT (1 << 2)
127e4ad08feSMiklos Szeredi
1285129a469SJörn Engel extern struct backing_dev_info noop_backing_dev_info;
1291da177e4SLinus Torvalds
1304bca7e80SJan Kara int bdi_init(struct backing_dev_info *bdi);
1314bca7e80SJan Kara
132bc05873dSTejun Heo /**
133bc05873dSTejun Heo * writeback_in_progress - determine whether there is writeback in progress
134bc05873dSTejun Heo * @wb: bdi_writeback of interest
135bc05873dSTejun Heo *
136bc05873dSTejun Heo * Determine whether there is writeback waiting to be handled against a
137bc05873dSTejun Heo * bdi_writeback.
138bc05873dSTejun Heo */
writeback_in_progress(struct bdi_writeback * wb)139bc05873dSTejun Heo static inline bool writeback_in_progress(struct bdi_writeback *wb)
1401da177e4SLinus Torvalds {
141bc05873dSTejun Heo return test_bit(WB_writeback_running, &wb->state);
142bc05873dSTejun Heo }
1431da177e4SLinus Torvalds
144ccdf7741SChristoph Hellwig struct backing_dev_info *inode_to_bdi(struct inode *inode);
145a212b105STejun Heo
mapping_can_writeback(struct address_space * mapping)146f56753acSChristoph Hellwig static inline bool mapping_can_writeback(struct address_space *mapping)
147e4ad08feSMiklos Szeredi {
148f56753acSChristoph Hellwig return inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK;
149e4ad08feSMiklos Szeredi }
1501da177e4SLinus Torvalds
15189e9b9e0STejun Heo #ifdef CONFIG_CGROUP_WRITEBACK
15289e9b9e0STejun Heo
153ed288dc0STejun Heo struct bdi_writeback *wb_get_lookup(struct backing_dev_info *bdi,
154ed288dc0STejun Heo struct cgroup_subsys_state *memcg_css);
15552ebea74STejun Heo struct bdi_writeback *wb_get_create(struct backing_dev_info *bdi,
15652ebea74STejun Heo struct cgroup_subsys_state *memcg_css,
15752ebea74STejun Heo gfp_t gfp);
15852ebea74STejun Heo void wb_memcg_offline(struct mem_cgroup *memcg);
159dec223c9SChristoph Hellwig void wb_blkcg_offline(struct cgroup_subsys_state *css);
16052ebea74STejun Heo
16189e9b9e0STejun Heo /**
16289e9b9e0STejun Heo * inode_cgwb_enabled - test whether cgroup writeback is enabled on an inode
16389e9b9e0STejun Heo * @inode: inode of interest
16489e9b9e0STejun Heo *
165ed7b6b4fSChristoph Hellwig * Cgroup writeback requires support from the filesystem. Also, both memcg and
166ed7b6b4fSChristoph Hellwig * iocg have to be on the default hierarchy. Test whether all conditions are
167ed7b6b4fSChristoph Hellwig * met.
1689badce00STejun Heo *
1699badce00STejun Heo * Note that the test result may change dynamically on the same inode
1709badce00STejun Heo * depending on how memcg and iocg are configured.
17189e9b9e0STejun Heo */
inode_cgwb_enabled(struct inode * inode)17289e9b9e0STejun Heo static inline bool inode_cgwb_enabled(struct inode *inode)
17389e9b9e0STejun Heo {
17489e9b9e0STejun Heo struct backing_dev_info *bdi = inode_to_bdi(inode);
17589e9b9e0STejun Heo
176c0522908STejun Heo return cgroup_subsys_on_dfl(memory_cgrp_subsys) &&
177c0522908STejun Heo cgroup_subsys_on_dfl(io_cgrp_subsys) &&
178f56753acSChristoph Hellwig (bdi->capabilities & BDI_CAP_WRITEBACK) &&
17946b15caaSTejun Heo (inode->i_sb->s_iflags & SB_I_CGROUPWB);
18089e9b9e0STejun Heo }
18189e9b9e0STejun Heo
18252ebea74STejun Heo /**
18352ebea74STejun Heo * wb_find_current - find wb for %current on a bdi
18452ebea74STejun Heo * @bdi: bdi of interest
18552ebea74STejun Heo *
18652ebea74STejun Heo * Find the wb of @bdi which matches both the memcg and blkcg of %current.
18752ebea74STejun Heo * Must be called under rcu_read_lock() which protects the returend wb.
18852ebea74STejun Heo * NULL if not found.
18952ebea74STejun Heo */
wb_find_current(struct backing_dev_info * bdi)19052ebea74STejun Heo static inline struct bdi_writeback *wb_find_current(struct backing_dev_info *bdi)
19152ebea74STejun Heo {
19252ebea74STejun Heo struct cgroup_subsys_state *memcg_css;
19352ebea74STejun Heo struct bdi_writeback *wb;
19452ebea74STejun Heo
19552ebea74STejun Heo memcg_css = task_css(current, memory_cgrp_id);
19652ebea74STejun Heo if (!memcg_css->parent)
19752ebea74STejun Heo return &bdi->wb;
19852ebea74STejun Heo
19952ebea74STejun Heo wb = radix_tree_lookup(&bdi->cgwb_tree, memcg_css->id);
20052ebea74STejun Heo
20152ebea74STejun Heo /*
20252ebea74STejun Heo * %current's blkcg equals the effective blkcg of its memcg. No
20352ebea74STejun Heo * need to use the relatively expensive cgroup_get_e_css().
20452ebea74STejun Heo */
205c165b3e3STejun Heo if (likely(wb && wb->blkcg_css == task_css(current, io_cgrp_id)))
20652ebea74STejun Heo return wb;
20752ebea74STejun Heo return NULL;
20852ebea74STejun Heo }
20952ebea74STejun Heo
21052ebea74STejun Heo /**
21152ebea74STejun Heo * wb_get_create_current - get or create wb for %current on a bdi
21252ebea74STejun Heo * @bdi: bdi of interest
21352ebea74STejun Heo * @gfp: allocation mask
21452ebea74STejun Heo *
21552ebea74STejun Heo * Equivalent to wb_get_create() on %current's memcg. This function is
21652ebea74STejun Heo * called from a relatively hot path and optimizes the common cases using
21752ebea74STejun Heo * wb_find_current().
21852ebea74STejun Heo */
21952ebea74STejun Heo static inline struct bdi_writeback *
wb_get_create_current(struct backing_dev_info * bdi,gfp_t gfp)22052ebea74STejun Heo wb_get_create_current(struct backing_dev_info *bdi, gfp_t gfp)
22152ebea74STejun Heo {
22252ebea74STejun Heo struct bdi_writeback *wb;
22352ebea74STejun Heo
22452ebea74STejun Heo rcu_read_lock();
22552ebea74STejun Heo wb = wb_find_current(bdi);
22652ebea74STejun Heo if (wb && unlikely(!wb_tryget(wb)))
22752ebea74STejun Heo wb = NULL;
22852ebea74STejun Heo rcu_read_unlock();
22952ebea74STejun Heo
23052ebea74STejun Heo if (unlikely(!wb)) {
23152ebea74STejun Heo struct cgroup_subsys_state *memcg_css;
23252ebea74STejun Heo
23352ebea74STejun Heo memcg_css = task_get_css(current, memory_cgrp_id);
23452ebea74STejun Heo wb = wb_get_create(bdi, memcg_css, gfp);
23552ebea74STejun Heo css_put(memcg_css);
23652ebea74STejun Heo }
23752ebea74STejun Heo return wb;
23852ebea74STejun Heo }
23952ebea74STejun Heo
24052ebea74STejun Heo /**
24152ebea74STejun Heo * inode_to_wb - determine the wb of an inode
24252ebea74STejun Heo * @inode: inode of interest
24352ebea74STejun Heo *
244aaa2cacfSTejun Heo * Returns the wb @inode is currently associated with. The caller must be
245b93b0163SMatthew Wilcox * holding either @inode->i_lock, the i_pages lock, or the
246aaa2cacfSTejun Heo * associated wb's list_lock.
24752ebea74STejun Heo */
inode_to_wb(const struct inode * inode)24805b93801SMatthew Wilcox static inline struct bdi_writeback *inode_to_wb(const struct inode *inode)
24952ebea74STejun Heo {
250aaa2cacfSTejun Heo #ifdef CONFIG_LOCKDEP
251aaa2cacfSTejun Heo WARN_ON_ONCE(debug_locks &&
252*9e888998SAndreas Gruenbacher (inode->i_sb->s_iflags & SB_I_CGROUPWB) &&
253aaa2cacfSTejun Heo (!lockdep_is_held(&inode->i_lock) &&
254b93b0163SMatthew Wilcox !lockdep_is_held(&inode->i_mapping->i_pages.xa_lock) &&
255aaa2cacfSTejun Heo !lockdep_is_held(&inode->i_wb->list_lock)));
256aaa2cacfSTejun Heo #endif
25752ebea74STejun Heo return inode->i_wb;
25852ebea74STejun Heo }
25952ebea74STejun Heo
inode_to_wb_wbc(struct inode * inode,struct writeback_control * wbc)260fee468fdSJan Kara static inline struct bdi_writeback *inode_to_wb_wbc(
261fee468fdSJan Kara struct inode *inode,
262fee468fdSJan Kara struct writeback_control *wbc)
263fee468fdSJan Kara {
264fee468fdSJan Kara /*
265fee468fdSJan Kara * If wbc does not have inode attached, it means cgroup writeback was
266fee468fdSJan Kara * disabled when wbc started. Just use the default wb in that case.
267fee468fdSJan Kara */
268fee468fdSJan Kara return wbc->wb ? wbc->wb : &inode_to_bdi(inode)->wb;
269fee468fdSJan Kara }
270fee468fdSJan Kara
271682aa8e1STejun Heo /**
272682aa8e1STejun Heo * unlocked_inode_to_wb_begin - begin unlocked inode wb access transaction
273682aa8e1STejun Heo * @inode: target inode
2742e898e4cSGreg Thelen * @cookie: output param, to be passed to the end function
275682aa8e1STejun Heo *
276682aa8e1STejun Heo * The caller wants to access the wb associated with @inode but isn't
277b93b0163SMatthew Wilcox * holding inode->i_lock, the i_pages lock or wb->list_lock. This
278682aa8e1STejun Heo * function determines the wb associated with @inode and ensures that the
279682aa8e1STejun Heo * association doesn't change until the transaction is finished with
280682aa8e1STejun Heo * unlocked_inode_to_wb_end().
281682aa8e1STejun Heo *
2822e898e4cSGreg Thelen * The caller must call unlocked_inode_to_wb_end() with *@cookie afterwards and
2832e898e4cSGreg Thelen * can't sleep during the transaction. IRQs may or may not be disabled on
2842e898e4cSGreg Thelen * return.
285682aa8e1STejun Heo */
286682aa8e1STejun Heo static inline struct bdi_writeback *
unlocked_inode_to_wb_begin(struct inode * inode,struct wb_lock_cookie * cookie)2872e898e4cSGreg Thelen unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
288682aa8e1STejun Heo {
289682aa8e1STejun Heo rcu_read_lock();
290682aa8e1STejun Heo
291682aa8e1STejun Heo /*
292a9519defSGreg Thelen * Paired with store_release in inode_switch_wbs_work_fn() and
293682aa8e1STejun Heo * ensures that we see the new wb if we see cleared I_WB_SWITCH.
294682aa8e1STejun Heo */
2952e898e4cSGreg Thelen cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
296682aa8e1STejun Heo
2972e898e4cSGreg Thelen if (unlikely(cookie->locked))
2982e898e4cSGreg Thelen xa_lock_irqsave(&inode->i_mapping->i_pages, cookie->flags);
299aaa2cacfSTejun Heo
300aaa2cacfSTejun Heo /*
301b93b0163SMatthew Wilcox * Protected by either !I_WB_SWITCH + rcu_read_lock() or the i_pages
302b93b0163SMatthew Wilcox * lock. inode_to_wb() will bark. Deref directly.
303aaa2cacfSTejun Heo */
304aaa2cacfSTejun Heo return inode->i_wb;
305682aa8e1STejun Heo }
306682aa8e1STejun Heo
307682aa8e1STejun Heo /**
308682aa8e1STejun Heo * unlocked_inode_to_wb_end - end inode wb access transaction
309682aa8e1STejun Heo * @inode: target inode
3102e898e4cSGreg Thelen * @cookie: @cookie from unlocked_inode_to_wb_begin()
311682aa8e1STejun Heo */
unlocked_inode_to_wb_end(struct inode * inode,struct wb_lock_cookie * cookie)3122e898e4cSGreg Thelen static inline void unlocked_inode_to_wb_end(struct inode *inode,
3132e898e4cSGreg Thelen struct wb_lock_cookie *cookie)
314682aa8e1STejun Heo {
3152e898e4cSGreg Thelen if (unlikely(cookie->locked))
3162e898e4cSGreg Thelen xa_unlock_irqrestore(&inode->i_mapping->i_pages, cookie->flags);
317682aa8e1STejun Heo
318682aa8e1STejun Heo rcu_read_unlock();
319682aa8e1STejun Heo }
320682aa8e1STejun Heo
32189e9b9e0STejun Heo #else /* CONFIG_CGROUP_WRITEBACK */
32289e9b9e0STejun Heo
inode_cgwb_enabled(struct inode * inode)32389e9b9e0STejun Heo static inline bool inode_cgwb_enabled(struct inode *inode)
32489e9b9e0STejun Heo {
32589e9b9e0STejun Heo return false;
32689e9b9e0STejun Heo }
32789e9b9e0STejun Heo
wb_find_current(struct backing_dev_info * bdi)32852ebea74STejun Heo static inline struct bdi_writeback *wb_find_current(struct backing_dev_info *bdi)
32952ebea74STejun Heo {
33052ebea74STejun Heo return &bdi->wb;
33152ebea74STejun Heo }
33252ebea74STejun Heo
33352ebea74STejun Heo static inline struct bdi_writeback *
wb_get_create_current(struct backing_dev_info * bdi,gfp_t gfp)33452ebea74STejun Heo wb_get_create_current(struct backing_dev_info *bdi, gfp_t gfp)
33552ebea74STejun Heo {
33652ebea74STejun Heo return &bdi->wb;
33752ebea74STejun Heo }
33852ebea74STejun Heo
inode_to_wb(struct inode * inode)33952ebea74STejun Heo static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
34052ebea74STejun Heo {
34152ebea74STejun Heo return &inode_to_bdi(inode)->wb;
34252ebea74STejun Heo }
34352ebea74STejun Heo
inode_to_wb_wbc(struct inode * inode,struct writeback_control * wbc)344fee468fdSJan Kara static inline struct bdi_writeback *inode_to_wb_wbc(
345fee468fdSJan Kara struct inode *inode,
346fee468fdSJan Kara struct writeback_control *wbc)
347fee468fdSJan Kara {
348fee468fdSJan Kara return inode_to_wb(inode);
349fee468fdSJan Kara }
350fee468fdSJan Kara
351fee468fdSJan Kara
352682aa8e1STejun Heo static inline struct bdi_writeback *
unlocked_inode_to_wb_begin(struct inode * inode,struct wb_lock_cookie * cookie)3532e898e4cSGreg Thelen unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
354682aa8e1STejun Heo {
355682aa8e1STejun Heo return inode_to_wb(inode);
356682aa8e1STejun Heo }
357682aa8e1STejun Heo
unlocked_inode_to_wb_end(struct inode * inode,struct wb_lock_cookie * cookie)3582e898e4cSGreg Thelen static inline void unlocked_inode_to_wb_end(struct inode *inode,
3592e898e4cSGreg Thelen struct wb_lock_cookie *cookie)
360682aa8e1STejun Heo {
361682aa8e1STejun Heo }
362682aa8e1STejun Heo
wb_memcg_offline(struct mem_cgroup * memcg)36352ebea74STejun Heo static inline void wb_memcg_offline(struct mem_cgroup *memcg)
36452ebea74STejun Heo {
36552ebea74STejun Heo }
36652ebea74STejun Heo
wb_blkcg_offline(struct cgroup_subsys_state * css)367dec223c9SChristoph Hellwig static inline void wb_blkcg_offline(struct cgroup_subsys_state *css)
36852ebea74STejun Heo {
36952ebea74STejun Heo }
37052ebea74STejun Heo
37189e9b9e0STejun Heo #endif /* CONFIG_CGROUP_WRITEBACK */
37289e9b9e0STejun Heo
373eb7ae5e0SChristoph Hellwig const char *bdi_dev_name(struct backing_dev_info *bdi);
37468f23b89STheodore Ts'o
3751da177e4SLinus Torvalds #endif /* _LINUX_BACKING_DEV_H */
376