diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-01-26 07:24:21 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-02-11 20:04:37 -0500 |
commit | 88dd8934194f6d1db7f824c03d1eee169cb891b0 (patch) | |
tree | 42e4ca9eba292b785b883ab0cba992a5e01d16ac /fs | |
parent | feeb0debfb3454726ebea3871cecac35e144d1bb (diff) |
f2fs: clean up {in,de}create_sleep_time
Use pointer parameter @wait to pass result in {in,de}create_sleep_time for
cleanup.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/gc.c | 8 | ||||
-rw-r--r-- | fs/f2fs/gc.h | 28 |
2 files changed, 18 insertions, 18 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 67860b6712f3..ba89e27f394f 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -44,7 +44,7 @@ static int gc_thread_func(void *data) | |||
44 | break; | 44 | break; |
45 | 45 | ||
46 | if (sbi->sb->s_writers.frozen >= SB_FREEZE_WRITE) { | 46 | if (sbi->sb->s_writers.frozen >= SB_FREEZE_WRITE) { |
47 | wait_ms = increase_sleep_time(gc_th, wait_ms); | 47 | increase_sleep_time(gc_th, &wait_ms); |
48 | continue; | 48 | continue; |
49 | } | 49 | } |
50 | 50 | ||
@@ -65,15 +65,15 @@ static int gc_thread_func(void *data) | |||
65 | continue; | 65 | continue; |
66 | 66 | ||
67 | if (!is_idle(sbi)) { | 67 | if (!is_idle(sbi)) { |
68 | wait_ms = increase_sleep_time(gc_th, wait_ms); | 68 | increase_sleep_time(gc_th, &wait_ms); |
69 | mutex_unlock(&sbi->gc_mutex); | 69 | mutex_unlock(&sbi->gc_mutex); |
70 | continue; | 70 | continue; |
71 | } | 71 | } |
72 | 72 | ||
73 | if (has_enough_invalid_blocks(sbi)) | 73 | if (has_enough_invalid_blocks(sbi)) |
74 | wait_ms = decrease_sleep_time(gc_th, wait_ms); | 74 | decrease_sleep_time(gc_th, &wait_ms); |
75 | else | 75 | else |
76 | wait_ms = increase_sleep_time(gc_th, wait_ms); | 76 | increase_sleep_time(gc_th, &wait_ms); |
77 | 77 | ||
78 | stat_inc_bggc_count(sbi); | 78 | stat_inc_bggc_count(sbi); |
79 | 79 | ||
diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 524543a6a34a..d5ff97c5e394 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h | |||
@@ -66,26 +66,26 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi) | |||
66 | return (long)(reclaimable_user_blocks * LIMIT_FREE_BLOCK) / 100; | 66 | return (long)(reclaimable_user_blocks * LIMIT_FREE_BLOCK) / 100; |
67 | } | 67 | } |
68 | 68 | ||
69 | static inline long increase_sleep_time(struct f2fs_gc_kthread *gc_th, long wait) | 69 | static inline void increase_sleep_time(struct f2fs_gc_kthread *gc_th, |
70 | long *wait) | ||
70 | { | 71 | { |
71 | if (wait == gc_th->no_gc_sleep_time) | 72 | if (*wait == gc_th->no_gc_sleep_time) |
72 | return wait; | 73 | return; |
73 | 74 | ||
74 | wait += gc_th->min_sleep_time; | 75 | *wait += gc_th->min_sleep_time; |
75 | if (wait > gc_th->max_sleep_time) | 76 | if (*wait > gc_th->max_sleep_time) |
76 | wait = gc_th->max_sleep_time; | 77 | *wait = gc_th->max_sleep_time; |
77 | return wait; | ||
78 | } | 78 | } |
79 | 79 | ||
80 | static inline long decrease_sleep_time(struct f2fs_gc_kthread *gc_th, long wait) | 80 | static inline void decrease_sleep_time(struct f2fs_gc_kthread *gc_th, |
81 | long *wait) | ||
81 | { | 82 | { |
82 | if (wait == gc_th->no_gc_sleep_time) | 83 | if (*wait == gc_th->no_gc_sleep_time) |
83 | wait = gc_th->max_sleep_time; | 84 | *wait = gc_th->max_sleep_time; |
84 | 85 | ||
85 | wait -= gc_th->min_sleep_time; | 86 | *wait -= gc_th->min_sleep_time; |
86 | if (wait <= gc_th->min_sleep_time) | 87 | if (*wait <= gc_th->min_sleep_time) |
87 | wait = gc_th->min_sleep_time; | 88 | *wait = gc_th->min_sleep_time; |
88 | return wait; | ||
89 | } | 89 | } |
90 | 90 | ||
91 | static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi) | 91 | static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi) |