Skip to content

Commit 296b8cb

Browse files
Zhiguo NiuJaegeuk Kim
authored andcommitted
f2fs: fix to avoid use GC_AT when setting gc_mode as GC_URGENT_LOW or GC_URGENT_MID
If gc_mode is set to GC_URGENT_LOW or GC_URGENT_MID, cost benefit GC approach should be used, but if ATGC is enabled at the same time, Age-threshold approach will be selected, which can only do amount of GC and it is much less than the numbers of CB approach. some traces: f2fs_gc-254:48-396 [007] ..... 2311600.684028: f2fs_gc_begin: dev = (254,48), gc_type = Background GC, no_background_GC = 0, nr_free_secs = 0, nodes = 1053, dents = 2, imeta = 18, free_sec:44898, free_seg:44898, rsv_seg:239, prefree_seg:0 f2fs_gc-254:48-396 [007] ..... 2311600.684527: f2fs_get_victim: dev = (254,48), type = No TYPE, policy = (Background GC, LFS-mode, Age-threshold), victim = 10, cost = 4294364975, ofs_unit = 1, pre_victim_secno = -1, prefree = 0, free = 44898 f2fs_gc-254:48-396 [007] ..... 2311600.714835: f2fs_gc_end: dev = (254,48), ret = 0, seg_freed = 0, sec_freed = 0, nodes = 1562, dents = 2, imeta = 18, free_sec:44898, free_seg:44898, rsv_seg:239, prefree_seg:0 f2fs_gc-254:48-396 [007] ..... 2311600.714843: f2fs_background_gc: dev = (254,48), wait_ms = 50, prefree = 0, free = 44898 f2fs_gc-254:48-396 [007] ..... 2311600.771785: f2fs_gc_begin: dev = (254,48), gc_type = Background GC, no_background_GC = 0, nr_free_secs = 0, nodes = 1562, dents = 2, imeta = 18, free_sec:44898, free_seg:44898, rsv_seg:239, prefree_seg: f2fs_gc-254:48-396 [007] ..... 2311600.772275: f2fs_gc_end: dev = (254,48), ret = -61, seg_freed = 0, sec_freed = 0, nodes = 1562, dents = 2, imeta = 18, free_sec:44898, free_seg:44898, rsv_seg:239, prefree_seg:0 Fixes: 0e5e811 ("f2fs: add GC_URGENT_LOW mode in gc_urgent") Fixes: d98af5f ("f2fs: introduce gc_urgent_mid mode") Signed-off-by: Zhiguo Niu <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 9395fb0 commit 296b8cb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,13 @@ Description: Do background GC aggressively when set. Set to 0 by default.
311311
GC approach and turns SSR mode on.
312312
gc urgent low(2): lowers the bar of checking I/O idling in
313313
order to process outstanding discard commands and GC a
314-
little bit aggressively. uses cost benefit GC approach.
314+
little bit aggressively. always uses cost benefit GC approach,
315+
and will override age-threshold GC approach if ATGC is enabled
316+
at the same time.
315317
gc urgent mid(3): does GC forcibly in a period of given
316318
gc_urgent_sleep_time and executes a mid level of I/O idling check.
317-
uses cost benefit GC approach.
319+
always uses cost benefit GC approach, and will override
320+
age-threshold GC approach if ATGC is enabled at the same time.
318321

319322
What: /sys/fs/f2fs/<disk>/gc_urgent_sleep_time
320323
Date: August 2017

fs/f2fs/gc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ static int select_gc_type(struct f2fs_sb_info *sbi, int gc_type)
257257

258258
switch (sbi->gc_mode) {
259259
case GC_IDLE_CB:
260+
case GC_URGENT_LOW:
261+
case GC_URGENT_MID:
260262
gc_mode = GC_CB;
261263
break;
262264
case GC_IDLE_GREEDY:

0 commit comments

Comments
 (0)