Skip to content

Commit 2223fe6

Browse files
Daeho JeongJaegeuk Kim
authored andcommitted
f2fs: increase BG GC migration window granularity when boosted for zoned devices
Need bigger BG GC migration window granularity when free section is running low. Signed-off-by: Daeho Jeong <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 4cdca5a commit 2223fe6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

fs/f2fs/gc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,10 +1728,18 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
17281728
sec_end_segno -= SEGS_PER_SEC(sbi) -
17291729
f2fs_usable_segs_in_sec(sbi, segno);
17301730

1731-
if (gc_type == BG_GC)
1732-
end_segno = start_segno +
1731+
if (gc_type == BG_GC) {
1732+
unsigned int window_granularity =
17331733
sbi->migration_window_granularity;
17341734

1735+
if (f2fs_sb_has_blkzoned(sbi) &&
1736+
!has_enough_free_blocks(sbi,
1737+
LIMIT_BOOST_ZONED_GC))
1738+
window_granularity *= BOOST_GC_MULTIPLE;
1739+
1740+
end_segno = start_segno + window_granularity;
1741+
}
1742+
17351743
if (end_segno > sec_end_segno)
17361744
end_segno = sec_end_segno;
17371745
}

fs/f2fs/gc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define LIMIT_NO_ZONED_GC 60 /* percentage over total user space of no gc for zoned devices */
3434
#define LIMIT_BOOST_ZONED_GC 25 /* percentage over total user space of boosted gc for zoned devices */
3535
#define DEF_MIGRATION_WINDOW_GRANULARITY_ZONED 3
36+
#define BOOST_GC_MULTIPLE 5
3637

3738
#define DEF_GC_FAILED_PINNED_FILES 2048
3839
#define MAX_GC_FAILED_PINNED_FILES USHRT_MAX

0 commit comments

Comments
 (0)