Skip to content

Commit

Permalink
f2fs: do gc in greedy mode for whole range if gc_urgent mode is set
Browse files Browse the repository at this point in the history
Otherwise, f2fs conducts GC on 8GB range only based on slow cost-benefit.

Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Jaegeuk Kim committed Apr 12, 2018
1 parent 43df79e commit 972aa9b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/f2fs/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,17 @@ static int select_gc_type(struct f2fs_gc_kthread *gc_th, int gc_type)
{
int gc_mode = (gc_type == BG_GC) ? GC_CB : GC_GREEDY;

if (gc_th && gc_th->gc_idle) {
if (!gc_th)
return gc_mode;

if (gc_th->gc_idle) {
if (gc_th->gc_idle == 1)
gc_mode = GC_CB;
else if (gc_th->gc_idle == 2)
gc_mode = GC_GREEDY;
}
if (gc_th->gc_urgent)
gc_mode = GC_GREEDY;
return gc_mode;
}

Expand All @@ -189,7 +194,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
}

/* we need to check every dirty segments in the FG_GC case */
if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
if (gc_type != FG_GC &&
(sbi->gc_thread && !sbi->gc_thread->gc_urgent) &&
p->max_search > sbi->max_victim_search)
p->max_search = sbi->max_victim_search;

/* let's select beginning hot/small space first in no_heap mode*/
Expand Down

0 comments on commit 972aa9b

Please sign in to comment.