f2fs: should get a victim from retrials
authorJaegeuk Kim <jaegeuk@kernel.org>
Sat, 19 Sep 2015 00:33:00 +0000 (17:33 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:55 +0000 (16:20 -0700)
If we do not call get_victim first, we cannot get a new victim for retrial
path.

Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c

index b6e03ebc703ca81988e6ed8a941d64f012e2f309..343b096cb654b731871bc16ee5a911c0c50e1fa9 100644 (file)
@@ -799,8 +799,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno,
 
 int f2fs_gc(struct f2fs_sb_info *sbi)
 {
-       unsigned int segno = NULL_SEGNO;
-       unsigned int i;
+       unsigned int segno, i;
        int gc_type = BG_GC;
        int sec_freed = 0;
        int ret = -1;
@@ -812,6 +811,8 @@ int f2fs_gc(struct f2fs_sb_info *sbi)
 
        cpc.reason = __get_cp_reason(sbi);
 gc_more:
+       segno = NULL_SEGNO;
+
        if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE)))
                goto stop;
        if (unlikely(f2fs_cp_error(sbi)))