diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 80b8500fa987..4bfc4452f299 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -910,6 +910,9 @@ int f2fs_get_victim(struct f2fs_sb_info *sbi, unsigned int *result, if (!f2fs_segment_has_free_slot(sbi, segno)) goto next; } + + if (!get_valid_blocks(sbi, segno, true)) + goto next; } if (gc_type == BG_GC && test_bit(secno, dirty_i->victim_secmap))