mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds
@ 2026-10-09  3:53 Wenjie Qi
  2026-10-09  8:29 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Wenjie Qi @ 2026-10-09  3:53 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, qiwenjie, qwjhust

When both cache writeback thresholds are zero,
f2fs_should_wake_up_cache_wb() returns true even with no dirty caches.
This makes wait_event_freezable_timeout() return immediately and the
writeback thread busy-loop instead of waiting for its periodic timeout.

Return false when both thresholds are disabled so periodic writeback
can proceed without busy-looping.

Fixes: d7f084b1ad93 ("f2fs: cache: wake up f2fs_writeback when exceeding threshold")
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
---
Based on f2fs/dev-test at ce439a2b0690.

 fs/f2fs/cache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/cache.c b/fs/f2fs/cache.c
index c76c4660606c5..88d4e479c8469 100644
--- a/fs/f2fs/cache.c
+++ b/fs/f2fs/cache.c
@@ -740,7 +740,8 @@ static inline bool f2fs_should_wake_up_cache_wb(struct f2fs_sb_info *sbi)
 	    nr_dirty < cache_thread->cache_wb_dirty_threshold)
 		return false;
 
-	return true;
+	return cache_thread->cache_wb_total_threshold ||
+		cache_thread->cache_wb_dirty_threshold;
 }
 
 static int f2fs_cache_writeback_kthread(void *data)
-- 
2.43.0


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

end of thread, other threads:[~2026-10-09  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09  3:53 [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds Wenjie Qi
2026-10-09  8:29 ` Chao Yu
2026-10-09  8:44   ` Wenjie Qi

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

all inboxes | Powered by JetHome®