f2fs: clean up {in,de}create_sleep_time
authorChao Yu <chao2.yu@samsung.com>
Mon, 26 Jan 2015 12:24:21 +0000 (20:24 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 12 Feb 2015 01:04:37 +0000 (17:04 -0800)
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>
fs/f2fs/gc.c
fs/f2fs/gc.h

index 67860b6712f3c8f4d676b851a298e94e44245088..ba89e27f394ffac3bcddcad48d2085146c36895c 100644 (file)
@@ -44,7 +44,7 @@ static int gc_thread_func(void *data)
                        break;
 
                if (sbi->sb->s_writers.frozen >= SB_FREEZE_WRITE) {
-                       wait_ms = increase_sleep_time(gc_th, wait_ms);
+                       increase_sleep_time(gc_th, &wait_ms);
                        continue;
                }
 
@@ -65,15 +65,15 @@ static int gc_thread_func(void *data)
                        continue;
 
                if (!is_idle(sbi)) {
-                       wait_ms = increase_sleep_time(gc_th, wait_ms);
+                       increase_sleep_time(gc_th, &wait_ms);
                        mutex_unlock(&sbi->gc_mutex);
                        continue;
                }
 
                if (has_enough_invalid_blocks(sbi))
-                       wait_ms = decrease_sleep_time(gc_th, wait_ms);
+                       decrease_sleep_time(gc_th, &wait_ms);
                else
-                       wait_ms = increase_sleep_time(gc_th, wait_ms);
+                       increase_sleep_time(gc_th, &wait_ms);
 
                stat_inc_bggc_count(sbi);
 
index 524543a6a34a939a9318bc5dfa1351b4a0e0dfe0..d5ff97c5e3942c7f85c81bf8f1a2a97b7e36068e 100644 (file)
@@ -66,26 +66,26 @@ static inline block_t limit_free_user_blocks(struct f2fs_sb_info *sbi)
        return (long)(reclaimable_user_blocks * LIMIT_FREE_BLOCK) / 100;
 }
 
-static inline long increase_sleep_time(struct f2fs_gc_kthread *gc_th, long wait)
+static inline void increase_sleep_time(struct f2fs_gc_kthread *gc_th,
+                                                               long *wait)
 {
-       if (wait == gc_th->no_gc_sleep_time)
-               return wait;
+       if (*wait == gc_th->no_gc_sleep_time)
+               return;
 
-       wait += gc_th->min_sleep_time;
-       if (wait > gc_th->max_sleep_time)
-               wait = gc_th->max_sleep_time;
-       return wait;
+       *wait += gc_th->min_sleep_time;
+       if (*wait > gc_th->max_sleep_time)
+               *wait = gc_th->max_sleep_time;
 }
 
-static inline long decrease_sleep_time(struct f2fs_gc_kthread *gc_th, long wait)
+static inline void decrease_sleep_time(struct f2fs_gc_kthread *gc_th,
+                                                               long *wait)
 {
-       if (wait == gc_th->no_gc_sleep_time)
-               wait = gc_th->max_sleep_time;
+       if (*wait == gc_th->no_gc_sleep_time)
+               *wait = gc_th->max_sleep_time;
 
-       wait -= gc_th->min_sleep_time;
-       if (wait <= gc_th->min_sleep_time)
-               wait = gc_th->min_sleep_time;
-       return wait;
+       *wait -= gc_th->min_sleep_time;
+       if (*wait <= gc_th->min_sleep_time)
+               *wait = gc_th->min_sleep_time;
 }
 
 static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi)
This page took 0.044156 seconds and 5 git commands to generate.