Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] fs: don't flush in-flight wb switches for superblocks without cgroup writeback
@ 2024-07-25  2:39 Haifeng Xu
  2024-07-25  8:42 ` Jan Kara
  0 siblings, 1 reply; 6+ messages in thread
From: Haifeng Xu @ 2024-07-25  2:39 UTC (permalink / raw)
  To: viro, brauner, jack, tj; +Cc: axboe, linux-fsdevel, linux-kernel, Haifeng Xu

When deactivating any type of superblock, it had to wait for the in-flight
wb switches to be completed. wb switches are executed in inode_switch_wbs_work_fn()
which needs to acquire the wb_switch_rwsem and races against sync_inodes_sb().
If there are too much dirty data in the superblock, the waiting time may increase
significantly.

For superblocks without cgroup writeback such as tmpfs, they have nothing to
do with the wb swithes, so the flushing can be avoided.

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
 fs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 095ba793e10c..f846f853e957 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -621,7 +621,8 @@ void generic_shutdown_super(struct super_block *sb)
 		sync_filesystem(sb);
 		sb->s_flags &= ~SB_ACTIVE;
 
-		cgroup_writeback_umount();
+		if (sb->s_bdi != &noop_backing_dev_info)
+			cgroup_writeback_umount();
 
 		/* Evict all inodes with zero refcount. */
 		evict_inodes(sb);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-29 11:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25  2:39 [PATCH] fs: don't flush in-flight wb switches for superblocks without cgroup writeback Haifeng Xu
2024-07-25  8:42 ` Jan Kara
2024-07-26  1:55   ` Haifeng Xu
2024-07-26  3:05   ` [PATCH v2] " Haifeng Xu
2024-07-26  7:09     ` Christian Brauner
2024-07-29 11:10     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox