* [PATCH] f2fs: ignore valid ratio when free section count is low
@ 2025-07-18 22:04 Daeho Jeong
2025-07-22 3:44 ` [f2fs-dev] " Chao Yu
2025-07-24 20:30 ` patchwork-bot+f2fs
0 siblings, 2 replies; 3+ messages in thread
From: Daeho Jeong @ 2025-07-18 22:04 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong
From: Daeho Jeong <daehojeong@google.com>
Otherwise F2FS will not do GC in background in low free section.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fs/f2fs/gc.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 0d7703e7f9e0..08eead027648 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -391,14 +391,15 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno)
}
static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi,
- unsigned int segno, struct victim_sel_policy *p)
+ unsigned int segno, struct victim_sel_policy *p,
+ unsigned int valid_thresh_ratio)
{
if (p->alloc_mode == SSR)
return get_seg_entry(sbi, segno)->ckpt_valid_blocks;
- if (p->one_time_gc && (get_valid_blocks(sbi, segno, true) >=
- CAP_BLKS_PER_SEC(sbi) * sbi->gc_thread->valid_thresh_ratio /
- 100))
+ if (p->one_time_gc && (valid_thresh_ratio < 100) &&
+ (get_valid_blocks(sbi, segno, true) >=
+ CAP_BLKS_PER_SEC(sbi) * valid_thresh_ratio / 100))
return UINT_MAX;
/* alloc_mode == LFS */
@@ -779,6 +780,7 @@ int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result,
unsigned int secno, last_victim;
unsigned int last_segment;
unsigned int nsearched;
+ unsigned int valid_thresh_ratio = 100;
bool is_atgc;
int ret = 0;
@@ -788,7 +790,11 @@ int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result,
p.alloc_mode = alloc_mode;
p.age = age;
p.age_threshold = sbi->am.age_threshold;
- p.one_time_gc = one_time;
+ if (one_time) {
+ p.one_time_gc = one_time;
+ if (has_enough_free_secs(sbi, 0, NR_PERSISTENT_LOG))
+ valid_thresh_ratio = sbi->gc_thread->valid_thresh_ratio;
+ }
retry:
select_policy(sbi, gc_type, type, &p);
@@ -914,7 +920,7 @@ int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result,
goto next;
}
- cost = get_gc_cost(sbi, segno, &p);
+ cost = get_gc_cost(sbi, segno, &p, valid_thresh_ratio);
if (p.min_cost > cost) {
p.min_segno = segno;
--
2.50.0.727.gbf7dc18ff4-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: ignore valid ratio when free section count is low
2025-07-18 22:04 [PATCH] f2fs: ignore valid ratio when free section count is low Daeho Jeong
@ 2025-07-22 3:44 ` Chao Yu
2025-07-24 20:30 ` patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2025-07-22 3:44 UTC (permalink / raw)
To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team
Cc: chao, Daeho Jeong
On 7/19/25 06:04, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> Otherwise F2FS will not do GC in background in low free section.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: ignore valid ratio when free section count is low
2025-07-18 22:04 [PATCH] f2fs: ignore valid ratio when free section count is low Daeho Jeong
2025-07-22 3:44 ` [f2fs-dev] " Chao Yu
@ 2025-07-24 20:30 ` patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2025-07-24 20:30 UTC (permalink / raw)
To: Daeho Jeong; +Cc: linux-kernel, linux-f2fs-devel, kernel-team, daehojeong
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Fri, 18 Jul 2025 15:04:31 -0700 you wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> Otherwise F2FS will not do GC in background in low free section.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> ---
> fs/f2fs/gc.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
Here is the summary with links:
- [f2fs-dev] f2fs: ignore valid ratio when free section count is low
https://git.kernel.org/jaegeuk/f2fs/c/e6d5e789c3b2
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:[~2025-07-24 20:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 22:04 [PATCH] f2fs: ignore valid ratio when free section count is low Daeho Jeong
2025-07-22 3:44 ` [f2fs-dev] " Chao Yu
2025-07-24 20:30 ` 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;
as well as URLs for NNTP newsgroup(s).