aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-02-04 01:11:17 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-02-11 17:15:02 -0500
commit437275272f9e635673f065300e5d95226a25cb06 (patch)
treebb0b8945d70971c200d098106b8879c1f84e109a /fs/f2fs/segment.c
parentb1f1daf8c72d615b64163e26488d8effeed29b60 (diff)
f2fs: clarify and enhance the f2fs_gc flow
This patch makes clearer the ambiguous f2fs_gc flow as follows. 1. Remove intermediate checkpoint condition during f2fs_gc (i.e., should_do_checkpoint() and GC_BLOCKED) 2. Remove unnecessary return values of f2fs_gc because of #1. (i.e., GC_NODE, GC_OK, etc) 3. Simplify write_checkpoint() because of #2. 4. Clarify the main f2fs_gc flow. o monitor how many freed sections during one iteration of do_garbage_collect(). o do GC more without checkpoints if we can't get enough free sections. o do checkpoint once we've got enough free sections through forground GCs. 5. Adopt thread-logging (Slack-Space-Recycle) scheme more aggressively on data log types. See. get_ssr_segement() Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 7aa270f3538a..777f17e496e6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -29,7 +29,7 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi)
29 * We should do GC or end up with checkpoint, if there are so many dirty 29 * We should do GC or end up with checkpoint, if there are so many dirty
30 * dir/node pages without enough free segments. 30 * dir/node pages without enough free segments.
31 */ 31 */
32 if (has_not_enough_free_secs(sbi)) { 32 if (has_not_enough_free_secs(sbi, 0)) {
33 mutex_lock(&sbi->gc_mutex); 33 mutex_lock(&sbi->gc_mutex);
34 f2fs_gc(sbi); 34 f2fs_gc(sbi);
35 } 35 }
@@ -308,7 +308,7 @@ static unsigned int check_prefree_segments(struct f2fs_sb_info *sbi,
308 * If there is not enough reserved sections, 308 * If there is not enough reserved sections,
309 * we should not reuse prefree segments. 309 * we should not reuse prefree segments.
310 */ 310 */
311 if (has_not_enough_free_secs(sbi)) 311 if (has_not_enough_free_secs(sbi, 0))
312 return NULL_SEGNO; 312 return NULL_SEGNO;
313 313
314 /* 314 /*
@@ -536,6 +536,23 @@ static void change_curseg(struct f2fs_sb_info *sbi, int type, bool reuse)
536 } 536 }
537} 537}
538 538
539static int get_ssr_segment(struct f2fs_sb_info *sbi, int type)
540{
541 struct curseg_info *curseg = CURSEG_I(sbi, type);
542 const struct victim_selection *v_ops = DIRTY_I(sbi)->v_ops;
543
544 if (IS_NODESEG(type) || !has_not_enough_free_secs(sbi, 0))
545 return v_ops->get_victim(sbi,
546 &(curseg)->next_segno, BG_GC, type, SSR);
547
548 /* For data segments, let's do SSR more intensively */
549 for (; type >= CURSEG_HOT_DATA; type--)
550 if (v_ops->get_victim(sbi, &(curseg)->next_segno,
551 BG_GC, type, SSR))
552 return 1;
553 return 0;
554}
555
539/* 556/*
540 * flush out current segment and replace it with new segment 557 * flush out current segment and replace it with new segment
541 * This function should be returned with success, otherwise BUG 558 * This function should be returned with success, otherwise BUG