Skip to content

Commit 9cfb816

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm/fs: convert inode_attach_wb() to take a folio
Patch series "Writeback folio conversions". Remove more calls to compound_head() by passing folios around instead of pages. This patch (of 2): The only caller of inode_attach_wb() which doesn't pass NULL already has a folio, so convert the whole call-chain to take folios. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 14ddee4 commit 9cfb816

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

fs/fs-writeback.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,16 @@ void wb_wait_for_completion(struct wb_completion *done)
237237
static atomic_t isw_nr_in_flight = ATOMIC_INIT(0);
238238
static struct workqueue_struct *isw_wq;
239239

240-
void __inode_attach_wb(struct inode *inode, struct page *page)
240+
void __inode_attach_wb(struct inode *inode, struct folio *folio)
241241
{
242242
struct backing_dev_info *bdi = inode_to_bdi(inode);
243243
struct bdi_writeback *wb = NULL;
244244

245245
if (inode_cgwb_enabled(inode)) {
246246
struct cgroup_subsys_state *memcg_css;
247247

248-
if (page) {
249-
memcg_css = mem_cgroup_css_from_page(page);
248+
if (folio) {
249+
memcg_css = mem_cgroup_css_from_page(&folio->page);
250250
wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC);
251251
} else {
252252
/* must pin memcg_css, see wb_get_create() */

include/linux/writeback.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static inline void wait_on_inode(struct inode *inode)
207207
#include <linux/cgroup.h>
208208
#include <linux/bio.h>
209209

210-
void __inode_attach_wb(struct inode *inode, struct page *page);
210+
void __inode_attach_wb(struct inode *inode, struct folio *folio);
211211
void wbc_attach_and_unlock_inode(struct writeback_control *wbc,
212212
struct inode *inode)
213213
__releases(&inode->i_lock);
@@ -222,16 +222,16 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb);
222222
/**
223223
* inode_attach_wb - associate an inode with its wb
224224
* @inode: inode of interest
225-
* @page: page being dirtied (may be NULL)
225+
* @folio: folio being dirtied (may be NULL)
226226
*
227227
* If @inode doesn't have its wb, associate it with the wb matching the
228-
* memcg of @page or, if @page is NULL, %current. May be called w/ or w/o
228+
* memcg of @folio or, if @folio is NULL, %current. May be called w/ or w/o
229229
* @inode->i_lock.
230230
*/
231-
static inline void inode_attach_wb(struct inode *inode, struct page *page)
231+
static inline void inode_attach_wb(struct inode *inode, struct folio *folio)
232232
{
233233
if (!inode->i_wb)
234-
__inode_attach_wb(inode, page);
234+
__inode_attach_wb(inode, folio);
235235
}
236236

237237
/**
@@ -290,7 +290,7 @@ static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio)
290290

291291
#else /* CONFIG_CGROUP_WRITEBACK */
292292

293-
static inline void inode_attach_wb(struct inode *inode, struct page *page)
293+
static inline void inode_attach_wb(struct inode *inode, struct folio *folio)
294294
{
295295
}
296296

mm/page-writeback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ static void folio_account_dirtied(struct folio *folio,
26522652
struct bdi_writeback *wb;
26532653
long nr = folio_nr_pages(folio);
26542654

2655-
inode_attach_wb(inode, &folio->page);
2655+
inode_attach_wb(inode, folio);
26562656
wb = inode_to_wb(inode);
26572657

26582658
__lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, nr);

0 commit comments

Comments
 (0)