OSDN Git Service

f2fs: trigger rapid GC only when screen state actually changes
authorPark Ju Hyung <qkrwngud825@gmail.com>
Wed, 14 Aug 2019 15:37:15 +0000 (00:37 +0900)
committer0ranko0P <ranko0p@outlook.com>
Tue, 24 Dec 2019 20:42:21 +0000 (04:42 +0800)
While it's normal for these events to happen after the other one,
with AOD or poorly made kernel source, we can receive the same event
consequently.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
fs/f2fs/gc.c

index 7a121ea..a3bf509 100644 (file)
@@ -327,10 +327,14 @@ static int fb_notifier_callback(struct notifier_block *self,
 
        switch (*blank) {
        case FB_BLANK_POWERDOWN:
+               if (trigger_rapid_gc)
+                       return NOTIFY_OK;
                trigger_rapid_gc = true;
                queue_work(system_power_efficient_wq, &rapid_gc_fb_worker);
                break;
        case FB_BLANK_UNBLANK:
+               if (!trigger_rapid_gc)
+                       return NOTIFY_OK;
                trigger_rapid_gc = false;
                queue_work(system_power_efficient_wq, &rapid_gc_fb_worker);
                break;