diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-04-24 00:00:14 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-04-25 21:35:03 -0400 |
commit | 6cb968d9b0358c7e807416a85699a526e820083c (patch) | |
tree | 8958e38642c540ea611b37b083e77e701a780c1a /fs/f2fs | |
parent | 2af4bd6ca556d690ee166200abd16fdbe749782e (diff) |
f2fs: avoid frequent background GC
If there is no victim segments selected by background GC, let's wait
a little bit longer time to collect dirty segments.
By default, let's give 5 minutes.
Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/gc.c | 3 | ||||
-rw-r--r-- | fs/f2fs/gc.h | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 1ca332455ee2..6ed3263eeee8 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -82,9 +82,6 @@ static int gc_thread_func(void *data) | |||
82 | /* if return value is not zero, no victim was selected */ | 82 | /* if return value is not zero, no victim was selected */ |
83 | if (f2fs_gc(sbi)) | 83 | if (f2fs_gc(sbi)) |
84 | wait_ms = GC_THREAD_NOGC_SLEEP_TIME; | 84 | wait_ms = GC_THREAD_NOGC_SLEEP_TIME; |
85 | else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME) | ||
86 | wait_ms = GC_THREAD_MAX_SLEEP_TIME; | ||
87 | |||
88 | } while (!kthread_should_stop()); | 85 | } while (!kthread_should_stop()); |
89 | return 0; | 86 | return 0; |
90 | } | 87 | } |
diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 30b2db003acd..2c6a6bd08322 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 10000 /* milliseconds */ | 16 | #define GC_THREAD_MIN_SLEEP_TIME 30000 /* milliseconds */ |
17 | #define GC_THREAD_MAX_SLEEP_TIME 30000 | 17 | #define GC_THREAD_MAX_SLEEP_TIME 60000 |
18 | #define GC_THREAD_NOGC_SLEEP_TIME 10000 | 18 | #define 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 | ||
@@ -58,6 +58,9 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi) | |||
58 | 58 | ||
59 | static inline long increase_sleep_time(long wait) | 59 | static inline long increase_sleep_time(long wait) |
60 | { | 60 | { |
61 | if (wait == GC_THREAD_NOGC_SLEEP_TIME) | ||
62 | return wait; | ||
63 | |||
61 | wait += GC_THREAD_MIN_SLEEP_TIME; | 64 | wait += GC_THREAD_MIN_SLEEP_TIME; |
62 | if (wait > GC_THREAD_MAX_SLEEP_TIME) | 65 | if (wait > GC_THREAD_MAX_SLEEP_TIME) |
63 | wait = GC_THREAD_MAX_SLEEP_TIME; | 66 | wait = GC_THREAD_MAX_SLEEP_TIME; |
@@ -66,6 +69,9 @@ static inline long increase_sleep_time(long wait) | |||
66 | 69 | ||
67 | static inline long decrease_sleep_time(long wait) | 70 | static inline long decrease_sleep_time(long wait) |
68 | { | 71 | { |
72 | if (wait == GC_THREAD_NOGC_SLEEP_TIME) | ||
73 | wait = GC_THREAD_MAX_SLEEP_TIME; | ||
74 | |||
69 | wait -= GC_THREAD_MIN_SLEEP_TIME; | 75 | wait -= GC_THREAD_MIN_SLEEP_TIME; |
70 | if (wait <= GC_THREAD_MIN_SLEEP_TIME) | 76 | if (wait <= GC_THREAD_MIN_SLEEP_TIME) |
71 | wait = GC_THREAD_MIN_SLEEP_TIME; | 77 | wait = GC_THREAD_MIN_SLEEP_TIME; |