diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-02-27 00:40:30 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-03-13 00:05:54 +0100 |
commit | b27bc8091ccf22f66ab105d10fa4f5cdeaef05a2 (patch) | |
tree | 9cdf5e339756f7afddc34a6bb12d3061f6f3dbaf /fs/f2fs | |
parent | f2fs: issue discard aggressively in the gc_urgent mode (diff) | |
download | linux-b27bc8091ccf22f66ab105d10fa4f5cdeaef05a2.tar.xz linux-b27bc8091ccf22f66ab105d10fa4f5cdeaef05a2.zip |
f2fs: do gc in greedy mode for whole range if gc_urgent mode is set
Otherwise, f2fs conducts GC on 8GB range only based on slow cost-benefit.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/gc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index bc9420ce2275..bfb7a4a3a929 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -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; } @@ -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*/ |