gc.c (93dfe2ac516250755f7d5edd438b0ce67c0e3aa6) gc.c (6bacf52fb58aeb3e89d9a62970b85a5570aa8ace)
1/*
2 * fs/f2fs/gc.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 105 unchanged lines hidden (view full) ---

114 init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head);
115 sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi,
116 "f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
117 if (IS_ERR(gc_th->f2fs_gc_task)) {
118 err = PTR_ERR(gc_th->f2fs_gc_task);
119 kfree(gc_th);
120 sbi->gc_thread = NULL;
121 }
1/*
2 * fs/f2fs/gc.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 105 unchanged lines hidden (view full) ---

114 init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head);
115 sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi,
116 "f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
117 if (IS_ERR(gc_th->f2fs_gc_task)) {
118 err = PTR_ERR(gc_th->f2fs_gc_task);
119 kfree(gc_th);
120 sbi->gc_thread = NULL;
121 }
122
123out:
124 return err;
125}
126
127void stop_gc_thread(struct f2fs_sb_info *sbi)
128{
129 struct f2fs_gc_kthread *gc_th = sbi->gc_thread;
130 if (!gc_th)

--- 559 unchanged lines hidden (view full) ---

690 struct list_head ilist;
691 unsigned int segno, i;
692 int gc_type = BG_GC;
693 int nfree = 0;
694 int ret = -1;
695
696 INIT_LIST_HEAD(&ilist);
697gc_more:
122out:
123 return err;
124}
125
126void stop_gc_thread(struct f2fs_sb_info *sbi)
127{
128 struct f2fs_gc_kthread *gc_th = sbi->gc_thread;
129 if (!gc_th)

--- 559 unchanged lines hidden (view full) ---

689 struct list_head ilist;
690 unsigned int segno, i;
691 int gc_type = BG_GC;
692 int nfree = 0;
693 int ret = -1;
694
695 INIT_LIST_HEAD(&ilist);
696gc_more:
698 if (!(sbi->sb->s_flags & MS_ACTIVE))
697 if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE)))
699 goto stop;
700
701 if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) {
702 gc_type = FG_GC;
703 write_checkpoint(sbi, false);
704 }
705
706 if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))

--- 42 unchanged lines hidden ---
698 goto stop;
699
700 if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) {
701 gc_type = FG_GC;
702 write_checkpoint(sbi, false);
703 }
704
705 if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))

--- 42 unchanged lines hidden ---