f2fs: continue to do fg_gc even if beyond max_victim_search
PATCH 1/1 f2fs: continue to do fg_gc even if beyond max_victim_search
For forground gc, if can't find a victim in one max_victim_search, try it again.
--- fs/f2fs/gc.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
fs/f2fs/gc.c +12 -11
@@ -916,24 +916,25 @@ gc_more: goto stop; } -if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi, sec_freed,0 )) { - gc_type =FG_GC ; +if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi,0 ,0 )) {/* * If there is no victim and no prefree segment but still not * enough free sections, we should flush dent/node blocks and do * garbage collections. */ -if (__get_victim (sbi, &segno, gc_type) || -prefree_segments (sbi)) { -write_checkpoint (sbi, &cpc); - segno =NULL_SEGNO ; - }else if (has_not_enough_free_secs (sbi,0 ,0 )) { -write_checkpoint (sbi, &cpc); - } + gc_type =FG_GC ; +write_checkpoint (sbi, &cpc); } -if (segno ==NULL_SEGNO && !__get_victim (sbi, &segno, gc_type)) - goto stop; +if (!__get_victim (sbi, &segno, gc_type)) { +if (sync) + goto stop; +else if (gc_type ==FG_GC + &&has_not_enough_free_secs (sbi, sec_freed,0 )) + goto gc_more; +else + goto stop; + } ret =0 ; if (do_garbage_collect(sbi, segno, &gc_list, gc_type) &&
Signature · 4 lines
1.9.1 ------------------------------------------------------------------------------
Quoted 33 lines · Yunlei He
For forground gc, if can't find a victim in one
max_victim_search, try it again.Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/gc.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)fs/f2fs/gc.c +3
-9@@ -916,24 +916,25 @@ gc_more: goto stop; } -if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi, sec_freed,0 )) { - gc_type =FG_GC ; +if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi,0 ,0 )) {/* * If there is no victim and no prefree segment but still not * enough free sections, we should flush dent/node blocks and do * garbage collections. */ -if (__get_victim (sbi, &segno, gc_type) || -prefree_segments (sbi)) { -write_checkpoint (sbi, &cpc); - segno =NULL_SEGNO ; - }else if (has_not_enough_free_secs (sbi,0 ,0 )) { -write_checkpoint (sbi, &cpc); - } + gc_type =FG_GC ; +write_checkpoint (sbi, &cpc);
fs/f2fs/gc.c gc_more: · line 934
Quoted 10 lines
fs/f2fs/gc.c +6
-2} -if (segno ==NULL_SEGNO && !__get_victim (sbi, &segno, gc_type)) - goto stop; +if (!__get_victim (sbi, &segno, gc_type)) { +if (sync) + goto stop; +else if (gc_type ==FG_GC + &&has_not_enough_free_secs (sbi, sec_freed,0 )) + goto gc_more;
Will we deadloop here?
Thanks,
fs/f2fs/gc.c gc_more: · line 940
Quoted 7 lines
fs/f2fs/gc.c +3
-0+else + goto stop; + } ret =0 ; if (do_garbage_collect(sbi, segno, &gc_list, gc_type) &&
------------------------------------------------------------------------------
Quoted 36 lines · Chao Yu
Quoted 35 lines · Yunlei He
For forground gc, if can't find a victim in one
max_victim_search, try it again.Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/gc.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)fs/f2fs/gc.c +3
-9@@ -916,24 +916,25 @@ gc_more: goto stop; } -if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi, sec_freed,0 )) { - gc_type =FG_GC ; +if (gc_type ==BG_GC &&has_not_enough_free_secs (sbi,0 ,0 )) {/* * If there is no victim and no prefree segment but still not * enough free sections, we should flush dent/node blocks and do * garbage collections. */ -if (__get_victim (sbi, &segno, gc_type) || -prefree_segments (sbi)) { -write_checkpoint (sbi, &cpc); - segno =NULL_SEGNO ; - }else if (has_not_enough_free_secs (sbi,0 ,0 )) { -write_checkpoint (sbi, &cpc); - } + gc_type =FG_GC ; +write_checkpoint (sbi, &cpc); }
Quoted 11 lines
fs/f2fs/gc.c gc_more: · line 934
Quoted 8 lines
fs/f2fs/gc.c +6
-2-if (segno ==NULL_SEGNO && !__get_victim (sbi, &segno, gc_type)) - goto stop; +if (!__get_victim (sbi, &segno, gc_type)) { +if (sync) + goto stop; +else if (gc_type ==FG_GC + &&has_not_enough_free_secs (sbi, sec_freed,0 )) + goto gc_more;Will we deadloop here?
Does no victim(whole partition) and has_not_enough_free_secs both satisfied at the same time?
If stop FG_GC here, it will come again soon, besides, sec_freed will not change to free segments,
for no checkpoint update.
Thanks,
Quoted 7 lines
Thanks,
Quoted 5 lines
fs/f2fs/gc.c +3
-0+else + goto stop; + } ret =0 ;
Quoted 6 lines
fs/f2fs/gc.c gc_more: · line 940
Quoted 2 lines
fs/f2fs/gc.c +0
-0if (do_garbage_collect(sbi, segno, &gc_list, gc_type) &&.
------------------------------------------------------------------------------