* [PATCH] f2fs: fix termination of f2fs_sync_meta_caches()
@ 2026-10-10 7:49 Seongjae Jeong
2026-10-11 10:37 ` Chao Yu
2026-10-13 22:30 ` [f2fs-dev] " patchwork-bot+f2fs
0 siblings, 2 replies; 3+ messages in thread
From: Seongjae Jeong @ 2026-10-10 7:49 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, Seongjae Jeong
When __f2fs_write_meta_cache() returns false in f2fs_sync_meta_caches(),
the function only exits the inner loop instead of the entire
while loop. This leads to an unnecessary lookup of the next batch.
Also, when nwritten >= nr_to_write, only the inner loop terminates.
This allows the function to continue processing subsequent batches
after the writeback budget has been reached.
Terminate the entire while loop in both cases to avoid unnecessary
batch lookups and respect the writeback budget.
Signed-off-by: Seongjae Jeong <jsjlee1020@gmail.com>
---
based on the f2fs dev-test at commit ce439a2b0690
fs/f2fs/checkpoint.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 2e5e0ee5feb2..4cafc96056ab 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -654,7 +654,8 @@ long f2fs_sync_meta_caches(struct f2fs_sb_info *sbi, long nr_to_write,
if (!__f2fs_write_meta_cache(entry, io_type)) {
f2fs_unlock_cache(entry);
- break;
+ f2fs_cache_gang_release(entries, nr);
+ goto stop;
}
nwritten++;
next = entry->index + 1;
@@ -663,6 +664,9 @@ long f2fs_sync_meta_caches(struct f2fs_sb_info *sbi, long nr_to_write,
}
f2fs_cache_gang_release(entries, nr);
cond_resched();
+
+ if (unlikely(nwritten >= nr_to_write))
+ break;
}
stop:
if (nwritten)
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: fix termination of f2fs_sync_meta_caches()
2026-10-10 7:49 [PATCH] f2fs: fix termination of f2fs_sync_meta_caches() Seongjae Jeong
@ 2026-10-11 10:37 ` Chao Yu
2026-10-13 22:30 ` [f2fs-dev] " patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2026-10-11 10:37 UTC (permalink / raw)
To: Seongjae Jeong, jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel
On 10/10/26 15:49, Seongjae Jeong wrote:
> When __f2fs_write_meta_cache() returns false in f2fs_sync_meta_caches(),
> the function only exits the inner loop instead of the entire
> while loop. This leads to an unnecessary lookup of the next batch.
>
> Also, when nwritten >= nr_to_write, only the inner loop terminates.
> This allows the function to continue processing subsequent batches
> after the writeback budget has been reached.
>
> Terminate the entire while loop in both cases to avoid unnecessary
> batch lookups and respect the writeback budget.
>
> Signed-off-by: Seongjae Jeong <jsjlee1020@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix termination of f2fs_sync_meta_caches()
2026-10-10 7:49 [PATCH] f2fs: fix termination of f2fs_sync_meta_caches() Seongjae Jeong
2026-10-11 10:37 ` Chao Yu
@ 2026-10-13 22:30 ` patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2026-10-13 22:30 UTC (permalink / raw)
To: Seongjae Jeong; +Cc: jaegeuk, chao, linux-kernel, linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Sat, 10 Oct 2026 07:49:12 +0000 you wrote:
> When __f2fs_write_meta_cache() returns false in f2fs_sync_meta_caches(),
> the function only exits the inner loop instead of the entire
> while loop. This leads to an unnecessary lookup of the next batch.
>
> Also, when nwritten >= nr_to_write, only the inner loop terminates.
> This allows the function to continue processing subsequent batches
> after the writeback budget has been reached.
>
> [...]
Here is the summary with links:
- [f2fs-dev] f2fs: fix termination of f2fs_sync_meta_caches()
https://git.kernel.org/jaegeuk/f2fs/c/a45c9a0055f5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 22:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 7:49 [PATCH] f2fs: fix termination of f2fs_sync_meta_caches() Seongjae Jeong
2026-10-11 10:37 ` Chao Yu
2026-10-13 22:30 ` [f2fs-dev] " patchwork-bot+f2fs
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®