* [PATCH 0/4] Avoid filesystem references to writeback internals
[not found] <CGME20260211070533epcas5p32f50f317b20250bb61b1b5a0b3a2a5d9@epcas5p3.samsung.com>
@ 2026-02-11 7:00 ` Kundan Kumar
2026-02-11 7:00 ` [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting Kundan Kumar
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Kundan Kumar @ 2026-02-11 7:00 UTC (permalink / raw)
To: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav
Cc: linux-f2fs-devel, linux-kernel, gfs2, linux-nfs, gost.dev,
anuj20.g, vishak.g, joshi.k, mcgrof, Kundan Kumar
The series introduces writeback helper APIs and converts f2fs, gfs2
and nfs to stop accessing writeback internals directly.
As suggested by Christoph [1], filesystem code that directly accesses
writeback internals is split out:
[1] https://lore.kernel.org/all/20251015072912.GA11294@lst.de/
No functional changes intended
Kundan Kumar (4):
writeback: prep helpers for dirty-limit and writeback accounting
f2fs: stop using writeback internals for dirty_exceeded checks
gfs2: stop using writeback internals for dirty_exceeded check
nfs: stop using writeback internals for WB_WRITEBACK accounting
fs/f2fs/node.c | 4 ++--
fs/f2fs/segment.h | 2 +-
fs/gfs2/super.c | 2 +-
fs/nfs/internal.h | 2 +-
fs/nfs/write.c | 4 ++--
include/linux/backing-dev.h | 11 +++++++++++
6 files changed, 18 insertions(+), 7 deletions(-)
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
@ 2026-02-11 7:00 ` Kundan Kumar
2026-02-11 10:39 ` Jan Kara
2026-02-11 7:00 ` [PATCH 2/4] f2fs: stop using writeback internals for dirty_exceeded checks Kundan Kumar
` (5 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Kundan Kumar @ 2026-02-11 7:00 UTC (permalink / raw)
To: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav
Cc: linux-f2fs-devel, linux-kernel, gfs2, linux-nfs, gost.dev,
anuj20.g, vishak.g, joshi.k, mcgrof, Kundan Kumar
Add helper APIs needed by filesystems to avoid poking into writeback
internals.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
include/linux/backing-dev.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 0c8342747cab..4165ad3ddf00 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -78,6 +78,17 @@ static inline s64 wb_stat_sum(struct bdi_writeback *wb, enum wb_stat_item item)
extern void wb_writeout_inc(struct bdi_writeback *wb);
+static inline int bdi_wb_dirty_exceeded(struct backing_dev_info *bdi)
+{
+ return bdi->wb.dirty_exceeded;
+}
+
+static inline void bdi_wb_stat_mod(struct backing_dev_info *bdi,
+ enum wb_stat_item item, s64 amount)
+{
+ wb_stat_mod(&bdi->wb, item, amount);
+}
+
/*
* maximal error of a stat counter.
*/
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] f2fs: stop using writeback internals for dirty_exceeded checks
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
2026-02-11 7:00 ` [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting Kundan Kumar
@ 2026-02-11 7:00 ` Kundan Kumar
2026-02-11 7:00 ` [PATCH 3/4] gfs2: stop using writeback internals for dirty_exceeded check Kundan Kumar
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Kundan Kumar @ 2026-02-11 7:00 UTC (permalink / raw)
To: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav
Cc: linux-f2fs-devel, linux-kernel, gfs2, linux-nfs, gost.dev,
anuj20.g, vishak.g, joshi.k, mcgrof, Kundan Kumar
Replace direct dereferences of dirty_exceeded with the core helper
bdi_wb_dirty_exceeded(), removing f2fs dependencies on writeback
internals.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
fs/f2fs/node.c | 4 ++--
fs/f2fs/segment.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 482a362f2625..d450b282cc55 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -78,7 +78,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type)
if (excess_cached_nats(sbi))
res = false;
} else if (type == DIRTY_DENTS) {
- if (sbi->sb->s_bdi->wb.dirty_exceeded)
+ if (bdi_wb_dirty_exceeded(sbi->sb->s_bdi))
return false;
mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
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)
res = false;
#endif
} else {
- if (!sbi->sb->s_bdi->wb.dirty_exceeded)
+ if (!bdi_wb_dirty_exceeded(sbi->sb->s_bdi))
return true;
}
return res;
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 07dcbcbeb7c6..d7166f1f000a 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -1000,7 +1000,7 @@ static inline bool sec_usage_check(struct f2fs_sb_info *sbi, unsigned int secno)
*/
static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type)
{
- if (sbi->sb->s_bdi->wb.dirty_exceeded)
+ if (bdi_wb_dirty_exceeded(sbi->sb->s_bdi))
return 0;
if (type == DATA)
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] gfs2: stop using writeback internals for dirty_exceeded check
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
2026-02-11 7:00 ` [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting Kundan Kumar
2026-02-11 7:00 ` [PATCH 2/4] f2fs: stop using writeback internals for dirty_exceeded checks Kundan Kumar
@ 2026-02-11 7:00 ` Kundan Kumar
2026-02-11 7:00 ` [PATCH 4/4] nfs: stop using writeback internals for WB_WRITEBACK accounting Kundan Kumar
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Kundan Kumar @ 2026-02-11 7:00 UTC (permalink / raw)
To: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav
Cc: linux-f2fs-devel, linux-kernel, gfs2, linux-nfs, gost.dev,
anuj20.g, vishak.g, joshi.k, mcgrof, Kundan Kumar
Convert gfs2 dirty_exceeded handling to use the writeback core helper
instead of accessing writeback directly.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
fs/gfs2/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f6cd907b3ec6..7ddeee19dec4 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -447,7 +447,7 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
gfs2_log_flush(GFS2_SB(inode), ip->i_gl,
GFS2_LOG_HEAD_FLUSH_NORMAL |
GFS2_LFC_WRITE_INODE);
- if (bdi->wb.dirty_exceeded)
+ if (bdi_wb_dirty_exceeded(bdi))
gfs2_ail1_flush(sdp, wbc);
else
filemap_fdatawrite(metamapping);
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] nfs: stop using writeback internals for WB_WRITEBACK accounting
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
` (2 preceding siblings ...)
2026-02-11 7:00 ` [PATCH 3/4] gfs2: stop using writeback internals for dirty_exceeded check Kundan Kumar
@ 2026-02-11 7:00 ` Kundan Kumar
2026-02-11 13:30 ` [PATCH 0/4] Avoid filesystem references to writeback internals Jeff Layton
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Kundan Kumar @ 2026-02-11 7:00 UTC (permalink / raw)
To: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav
Cc: linux-f2fs-devel, linux-kernel, gfs2, linux-nfs, gost.dev,
anuj20.g, vishak.g, joshi.k, mcgrof, Kundan Kumar
Convert NFS WB_WRITEBACK accounting to bdi-scoped writeback helper,
eliminating direct access to writeback.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
fs/nfs/internal.h | 2 +-
fs/nfs/write.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 2e596244799f..a738c357b153 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -866,7 +866,7 @@ static inline void nfs_folio_mark_unstable(struct folio *folio,
* writeback is happening on the server now.
*/
node_stat_mod_folio(folio, NR_WRITEBACK, nr);
- wb_stat_mod(&inode_to_bdi(inode)->wb, WB_WRITEBACK, nr);
+ bdi_wb_stat_mod(inode_to_bdi(inode), WB_WRITEBACK, nr);
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
}
}
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index bf412455e8ed..c56b15b5380f 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -872,8 +872,8 @@ static void nfs_folio_clear_commit(struct folio *folio)
long nr = folio_nr_pages(folio);
node_stat_mod_folio(folio, NR_WRITEBACK, -nr);
- wb_stat_mod(&inode_to_bdi(folio->mapping->host)->wb,
- WB_WRITEBACK, -nr);
+ bdi_wb_stat_mod(inode_to_bdi(folio->mapping->host),
+ WB_WRITEBACK, -nr);
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting
2026-02-11 7:00 ` [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting Kundan Kumar
@ 2026-02-11 10:39 ` Jan Kara
0 siblings, 0 replies; 9+ messages in thread
From: Jan Kara @ 2026-02-11 10:39 UTC (permalink / raw)
To: Kundan Kumar
Cc: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav, linux-f2fs-devel, linux-kernel, gfs2,
linux-nfs, gost.dev, anuj20.g, vishak.g, joshi.k, mcgrof
On Wed 11-02-26 12:30:54, Kundan Kumar wrote:
> Add helper APIs needed by filesystems to avoid poking into writeback
> internals.
>
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Looks sensible. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> include/linux/backing-dev.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
> index 0c8342747cab..4165ad3ddf00 100644
> --- a/include/linux/backing-dev.h
> +++ b/include/linux/backing-dev.h
> @@ -78,6 +78,17 @@ static inline s64 wb_stat_sum(struct bdi_writeback *wb, enum wb_stat_item item)
>
> extern void wb_writeout_inc(struct bdi_writeback *wb);
>
> +static inline int bdi_wb_dirty_exceeded(struct backing_dev_info *bdi)
> +{
> + return bdi->wb.dirty_exceeded;
> +}
> +
> +static inline void bdi_wb_stat_mod(struct backing_dev_info *bdi,
> + enum wb_stat_item item, s64 amount)
> +{
> + wb_stat_mod(&bdi->wb, item, amount);
> +}
> +
> /*
> * maximal error of a stat counter.
> */
> --
> 2.25.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] Avoid filesystem references to writeback internals
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
` (3 preceding siblings ...)
2026-02-11 7:00 ` [PATCH 4/4] nfs: stop using writeback internals for WB_WRITEBACK accounting Kundan Kumar
@ 2026-02-11 13:30 ` Jeff Layton
2026-02-11 13:49 ` Andreas Gruenbacher
2026-02-11 15:53 ` Christoph Hellwig
6 siblings, 0 replies; 9+ messages in thread
From: Jeff Layton @ 2026-02-11 13:30 UTC (permalink / raw)
To: Kundan Kumar, jaegeuk, chao, agruenba, trondmy, anna, hch,
brauner, jack, viro, djwong, pankaj.raghav
Cc: linux-f2fs-devel, linux-kernel, gfs2, linux-nfs, gost.dev,
anuj20.g, vishak.g, joshi.k, mcgrof
On Wed, 2026-02-11 at 12:30 +0530, Kundan Kumar wrote:
> The series introduces writeback helper APIs and converts f2fs, gfs2
> and nfs to stop accessing writeback internals directly.
>
> As suggested by Christoph [1], filesystem code that directly accesses
> writeback internals is split out:
> [1] https://lore.kernel.org/all/20251015072912.GA11294@lst.de/
>
> No functional changes intended
>
> Kundan Kumar (4):
> writeback: prep helpers for dirty-limit and writeback accounting
> f2fs: stop using writeback internals for dirty_exceeded checks
> gfs2: stop using writeback internals for dirty_exceeded check
> nfs: stop using writeback internals for WB_WRITEBACK accounting
>
> fs/f2fs/node.c | 4 ++--
> fs/f2fs/segment.h | 2 +-
> fs/gfs2/super.c | 2 +-
> fs/nfs/internal.h | 2 +-
> fs/nfs/write.c | 4 ++--
> include/linux/backing-dev.h | 11 +++++++++++
> 6 files changed, 18 insertions(+), 7 deletions(-)
>
>
> base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
Seems sensible.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] Avoid filesystem references to writeback internals
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
` (4 preceding siblings ...)
2026-02-11 13:30 ` [PATCH 0/4] Avoid filesystem references to writeback internals Jeff Layton
@ 2026-02-11 13:49 ` Andreas Gruenbacher
2026-02-11 15:53 ` Christoph Hellwig
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Gruenbacher @ 2026-02-11 13:49 UTC (permalink / raw)
To: Kundan Kumar
Cc: jaegeuk, chao, trondmy, anna, hch, brauner, jack, viro, djwong,
pankaj.raghav, linux-f2fs-devel, linux-kernel, gfs2, linux-nfs,
gost.dev, anuj20.g, vishak.g, joshi.k, mcgrof
On Wed, Feb 11, 2026 at 8:13 AM Kundan Kumar <kundan.kumar@samsung.com> wrote:
> The series introduces writeback helper APIs and converts f2fs, gfs2
> and nfs to stop accessing writeback internals directly.
>
> As suggested by Christoph [1], filesystem code that directly accesses
> writeback internals is split out:
> [1] https://lore.kernel.org/all/20251015072912.GA11294@lst.de/
>
> No functional changes intended
>
> Kundan Kumar (4):
> writeback: prep helpers for dirty-limit and writeback accounting
> f2fs: stop using writeback internals for dirty_exceeded checks
> gfs2: stop using writeback internals for dirty_exceeded check
> nfs: stop using writeback internals for WB_WRITEBACK accounting
>
> fs/f2fs/node.c | 4 ++--
> fs/f2fs/segment.h | 2 +-
> fs/gfs2/super.c | 2 +-
> fs/nfs/internal.h | 2 +-
> fs/nfs/write.c | 4 ++--
> include/linux/backing-dev.h | 11 +++++++++++
> 6 files changed, 18 insertions(+), 7 deletions(-)
>
>
> base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
Sure, that won't hurt.
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] Avoid filesystem references to writeback internals
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
` (5 preceding siblings ...)
2026-02-11 13:49 ` Andreas Gruenbacher
@ 2026-02-11 15:53 ` Christoph Hellwig
6 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-02-11 15:53 UTC (permalink / raw)
To: Kundan Kumar
Cc: jaegeuk, chao, agruenba, trondmy, anna, hch, brauner, jack, viro,
djwong, pankaj.raghav, linux-f2fs-devel, linux-kernel, gfs2,
linux-nfs, gost.dev, anuj20.g, vishak.g, joshi.k, mcgrof
Looks fine as a cleanup, but maybe add comments that these functions
must not be used by file systems that support cgroup writeback and
thus can have multiple bdi_writeback structures per bdi?
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-02-11 15:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20260211070533epcas5p32f50f317b20250bb61b1b5a0b3a2a5d9@epcas5p3.samsung.com>
2026-02-11 7:00 ` [PATCH 0/4] Avoid filesystem references to writeback internals Kundan Kumar
2026-02-11 7:00 ` [PATCH 1/4] writeback: prep helpers for dirty-limit and writeback accounting Kundan Kumar
2026-02-11 10:39 ` Jan Kara
2026-02-11 7:00 ` [PATCH 2/4] f2fs: stop using writeback internals for dirty_exceeded checks Kundan Kumar
2026-02-11 7:00 ` [PATCH 3/4] gfs2: stop using writeback internals for dirty_exceeded check Kundan Kumar
2026-02-11 7:00 ` [PATCH 4/4] nfs: stop using writeback internals for WB_WRITEBACK accounting Kundan Kumar
2026-02-11 13:30 ` [PATCH 0/4] Avoid filesystem references to writeback internals Jeff Layton
2026-02-11 13:49 ` Andreas Gruenbacher
2026-02-11 15:53 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox