]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
writeback: prep helpers for dirty-limit and writeback accounting
authorKundan Kumar <kundan.kumar@samsung.com>
Fri, 13 Feb 2026 05:46:31 +0000 (11:16 +0530)
committerChristian Brauner <brauner@kernel.org>
Tue, 17 Feb 2026 12:25:13 +0000 (13:25 +0100)
Add helper APIs needed by filesystems to avoid poking into writeback
internals.

Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
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>
Link: https://patch.msgid.link/20260213054634.79785-2-kundan.kumar@samsung.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/backing-dev.h

index 0c8342747cab15f75b0098a0a156d44efcb99426..5b7d12b40d5e7a2bf8857e1fba66626d23924655 100644 (file)
@@ -136,6 +136,19 @@ static inline bool mapping_can_writeback(struct address_space *mapping)
        return inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK;
 }
 
+/* Must not be used by file systems that support cgroup writeback */
+static inline int bdi_wb_dirty_exceeded(struct backing_dev_info *bdi)
+{
+       return bdi->wb.dirty_exceeded;
+}
+
+/* Must not be used by file systems that support cgroup writeback */
+static inline void bdi_wb_stat_mod(struct inode *inode, enum wb_stat_item item,
+                                  s64 amount)
+{
+       wb_stat_mod(&inode_to_bdi(inode)->wb, item, amount);
+}
+
 #ifdef CONFIG_CGROUP_WRITEBACK
 
 struct bdi_writeback *wb_get_lookup(struct backing_dev_info *bdi,