Skip to content

Commit 0e58e3f

Browse files
committed
Merge tag 'vfs-7.1-rc1.writeback' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs writeback updates from Christian Brauner: "This introduces writeback helper APIs and converts f2fs, gfs2 and nfs to stop accessing writeback internals directly" * tag 'vfs-7.1-rc1.writeback' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: nfs: stop using writeback internals for WB_WRITEBACK accounting gfs2: stop using writeback internals for dirty_exceeded check f2fs: stop using writeback internals for dirty_exceeded checks writeback: prep helpers for dirty-limit and writeback accounting
2 parents 26ff969 + 8656686 commit 0e58e3f

6 files changed

Lines changed: 19 additions & 7 deletions

File tree

fs/f2fs/node.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type)
7878
if (excess_cached_nats(sbi))
7979
res = false;
8080
} else if (type == DIRTY_DENTS) {
81-
if (sbi->sb->s_bdi->wb.dirty_exceeded)
81+
if (bdi_wb_dirty_exceeded(sbi->sb->s_bdi))
8282
return false;
8383
mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
8484
res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
@@ -119,7 +119,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type)
119119
res = false;
120120
#endif
121121
} else {
122-
if (!sbi->sb->s_bdi->wb.dirty_exceeded)
122+
if (!bdi_wb_dirty_exceeded(sbi->sb->s_bdi))
123123
return true;
124124
}
125125
return res;

fs/f2fs/segment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ static inline bool sec_usage_check(struct f2fs_sb_info *sbi, unsigned int secno)
992992
*/
993993
static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type)
994994
{
995-
if (sbi->sb->s_bdi->wb.dirty_exceeded)
995+
if (bdi_wb_dirty_exceeded(sbi->sb->s_bdi))
996996
return 0;
997997

998998
if (type == DATA)

fs/gfs2/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
449449
gfs2_log_flush(GFS2_SB(inode), ip->i_gl,
450450
GFS2_LOG_HEAD_FLUSH_NORMAL |
451451
GFS2_LFC_WRITE_INODE);
452-
if (bdi->wb.dirty_exceeded)
452+
if (bdi_wb_dirty_exceeded(bdi))
453453
gfs2_ail1_flush(sdp, wbc);
454454
else
455455
filemap_fdatawrite(metamapping);

fs/nfs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio,
859859
* writeback is happening on the server now.
860860
*/
861861
node_stat_mod_folio(folio, NR_WRITEBACK, nr);
862-
wb_stat_mod(&inode_to_bdi(inode)->wb, WB_WRITEBACK, nr);
862+
bdi_wb_stat_mod(inode, WB_WRITEBACK, nr);
863863
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
864864
}
865865
}

fs/nfs/write.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,7 @@ static void nfs_folio_clear_commit(struct folio *folio)
872872
long nr = folio_nr_pages(folio);
873873

874874
node_stat_mod_folio(folio, NR_WRITEBACK, -nr);
875-
wb_stat_mod(&inode_to_bdi(folio->mapping->host)->wb,
876-
WB_WRITEBACK, -nr);
875+
bdi_wb_stat_mod(folio->mapping->host, WB_WRITEBACK, -nr);
877876
}
878877
}
879878

include/linux/backing-dev.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ static inline bool mapping_can_writeback(struct address_space *mapping)
136136
return inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK;
137137
}
138138

139+
/* Must not be used by file systems that support cgroup writeback */
140+
static inline int bdi_wb_dirty_exceeded(struct backing_dev_info *bdi)
141+
{
142+
return bdi->wb.dirty_exceeded;
143+
}
144+
145+
/* Must not be used by file systems that support cgroup writeback */
146+
static inline void bdi_wb_stat_mod(struct inode *inode, enum wb_stat_item item,
147+
s64 amount)
148+
{
149+
wb_stat_mod(&inode_to_bdi(inode)->wb, item, amount);
150+
}
151+
139152
#ifdef CONFIG_CGROUP_WRITEBACK
140153

141154
struct bdi_writeback *wb_get_lookup(struct backing_dev_info *bdi,

0 commit comments

Comments
 (0)