f2fs: add migration count iff migration happens
authorJaegeuk Kim <jaegeuk@kernel.org>
Sun, 9 Feb 2020 21:27:09 +0000 (13:27 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 19 Mar 2020 18:41:26 +0000 (11:41 -0700)
If first segment is empty and migration_granularity is 1, we can't move this
at all.

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

index a19966b..bb0b643 100644 (file)
@@ -1240,12 +1240,12 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
                                                        segno, gc_type);
 
                stat_inc_seg_count(sbi, type, gc_type);
+               migrated++;
 
 freed:
                if (gc_type == FG_GC &&
                                get_valid_blocks(sbi, segno, false) == 0)
                        seg_freed++;
-               migrated++;
 
                if (__is_large_section(sbi) && segno + 1 < end_segno)
                        sbi->next_victim_seg[gc_type] = segno + 1;