diff options
Diffstat (limited to 'fs/f2fs/gc.h')
-rw-r--r-- | fs/f2fs/gc.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 2c6a6bd08322..f4bf44c9deda 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h | |||
@@ -13,9 +13,9 @@ | |||
13 | * whether IO subsystem is idle | 13 | * whether IO subsystem is idle |
14 | * or not | 14 | * or not |
15 | */ | 15 | */ |
16 | #define GC_THREAD_MIN_SLEEP_TIME 30000 /* milliseconds */ | 16 | #define DEF_GC_THREAD_MIN_SLEEP_TIME 30000 /* milliseconds */ |
17 | #define GC_THREAD_MAX_SLEEP_TIME 60000 | 17 | #define DEF_GC_THREAD_MAX_SLEEP_TIME 60000 |
18 | #define GC_THREAD_NOGC_SLEEP_TIME 300000 /* wait 5 min */ | 18 | #define DEF_GC_THREAD_NOGC_SLEEP_TIME 300000 /* wait 5 min */ |
19 | #define LIMIT_INVALID_BLOCK 40 /* percentage over total user space */ | 19 | #define LIMIT_INVALID_BLOCK 40 /* percentage over total user space */ |
20 | #define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */ | 20 | #define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */ |
21 | 21 | ||
@@ -25,6 +25,11 @@ | |||
25 | struct f2fs_gc_kthread { | 25 | struct f2fs_gc_kthread { |
26 | struct task_struct *f2fs_gc_task; | 26 | struct task_struct *f2fs_gc_task; |
27 | wait_queue_head_t gc_wait_queue_head; | 27 | wait_queue_head_t gc_wait_queue_head; |
28 | |||
29 | /* for gc sleep time */ | ||
30 | unsigned int min_sleep_time; | ||
31 | unsigned int max_sleep_time; | ||
32 | unsigned int no_gc_sleep_time; | ||
28 | }; | 33 | }; |
29 | 34 | ||
30 | struct inode_entry { | 35 | struct inode_entry { |
@@ -56,25 +61,25 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi) | |||
56 | return (long)(reclaimable_user_blocks * LIMIT_FREE_BLOCK) / 100; | 61 | return (long)(reclaimable_user_blocks * LIMIT_FREE_BLOCK) / 100; |
57 | } | 62 | } |
58 | 63 | ||
59 | static inline long increase_sleep_time(long wait) | 64 | static inline long increase_sleep_time(struct f2fs_gc_kthread *gc_th, long wait) |
60 | { | 65 | { |
61 | if (wait == GC_THREAD_NOGC_SLEEP_TIME) | 66 | if (wait == gc_th->no_gc_sleep_time) |
62 | return wait; | 67 | return wait; |
63 | 68 | ||
64 | wait += GC_THREAD_MIN_SLEEP_TIME; | 69 | wait += gc_th->min_sleep_time; |
65 | if (wait > GC_THREAD_MAX_SLEEP_TIME) | 70 | if (wait > gc_th->max_sleep_time) |
66 | wait = GC_THREAD_MAX_SLEEP_TIME; | 71 | wait = gc_th->max_sleep_time; |
67 | return wait; | 72 | return wait; |
68 | } | 73 | } |
69 | 74 | ||
70 | static inline long decrease_sleep_time(long wait) | 75 | static inline long decrease_sleep_time(struct f2fs_gc_kthread *gc_th, long wait) |
71 | { | 76 | { |
72 | if (wait == GC_THREAD_NOGC_SLEEP_TIME) | 77 | if (wait == gc_th->no_gc_sleep_time) |
73 | wait = GC_THREAD_MAX_SLEEP_TIME; | 78 | wait = gc_th->max_sleep_time; |
74 | 79 | ||
75 | wait -= GC_THREAD_MIN_SLEEP_TIME; | 80 | wait -= gc_th->min_sleep_time; |
76 | if (wait <= GC_THREAD_MIN_SLEEP_TIME) | 81 | if (wait <= gc_th->min_sleep_time) |
77 | wait = GC_THREAD_MIN_SLEEP_TIME; | 82 | wait = gc_th->min_sleep_time; |
78 | return wait; | 83 | return wait; |
79 | } | 84 | } |
80 | 85 | ||