Skip to content
This repository has been archived by the owner on Sep 9, 2019. It is now read-only.

Commit

Permalink
f2fs/rapid_gc: do not wait until all invalid blocks are discarded
Browse files Browse the repository at this point in the history
Undiscarded blocks may not reach 0 for various reasons, such as
discard granularity settings and discard thread terminating before GC ends,
and when that happens, GC thread enters an indefinite loop.

Remove this logic entirely.

This is not much of an issue since discard thread does not rely on rapid GC.

Signed-off-by: Park Ju Hyung <[email protected]>
Signed-off-by: kdrag0n <[email protected]>
  • Loading branch information
arter97 authored and kdrag0n committed Feb 20, 2019
1 parent 2d8de37 commit d28cc16
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions fs/f2fs/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ static int gc_thread_func(void *data)
{
struct f2fs_sb_info *sbi = data;
struct f2fs_gc_kthread *gc_th = sbi->gc_thread;
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
wait_queue_head_t *wq = &sbi->gc_thread->gc_wait_queue_head;
unsigned int wait_ms = gc_th->min_sleep_time;
bool force_gc;
Expand Down Expand Up @@ -136,15 +135,12 @@ static int gc_thread_func(void *data)

/* if return value is not zero, no victim was selected */
if (f2fs_gc(sbi, force_gc || test_opt(sbi, FORCE_FG_GC), true, NULL_SEGNO)) {
/* also wait until all invalid blocks are discarded */
if (dcc->undiscard_blks == 0) {
wait_ms = gc_th->no_gc_sleep_time;
gc_set_wakelock(sbi, gc_th, false);
gc_th->gc_urgent = 0;
f2fs_msg(sbi->sb, KERN_INFO,
"No more GC victim found, "
"sleeping for %u ms", wait_ms);
}
wait_ms = gc_th->no_gc_sleep_time;
gc_set_wakelock(sbi, gc_th, false);
gc_th->gc_urgent = 0;
f2fs_msg(sbi->sb, KERN_INFO,
"No more GC victim found, "
"sleeping for %u ms", wait_ms);
}

trace_f2fs_background_gc(sbi->sb, wait_ms,
Expand Down

0 comments on commit d28cc16

Please sign in to comment.