Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9671c6f8 authored by Park Ju Hyung's avatar Park Ju Hyung Committed by Razziell
Browse files

f2fs: queue rapid GC on system_power_efficient_wq



Handle this asynchronously to avoid wake-up delay.
Use system_power_efficient_wq since this is not CPU intensive.

Change-Id: I6d8e7b47ed52195300301177a4c586d64689377c
Signed-off-by: default avatarPark Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: default avatarAlbert I <krascgq@outlook.co.id>
parent 3ead342f
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -261,6 +261,22 @@ void f2fs_sbi_list_del(struct f2fs_sb_info *sbi)
	mutex_unlock(&f2fs_sbi_mutex);
}

static struct work_struct f2fs_gc_fb_worker;
static void f2fs_gc_fb_work(struct work_struct *work)
{
	if (screen_on) {
		stop_all_gc_threads();
	} else {
		/*
		 * Start all GC threads exclusively from here
		 * since the phone screen would turn on when
		 * a charger is connected
		 */
		if (TRIGGER_SOFF)
			start_all_gc_threads();
	}
}

static int fb_notifier_callback(struct notifier_block *self,
				unsigned long event, void *data)
{
@@ -273,17 +289,11 @@ static int fb_notifier_callback(struct notifier_block *self,
		switch (*blank) {
		case FB_BLANK_POWERDOWN:
			screen_on = false;
			/*
			 * Start all GC threads exclusively from here
			 * since the phone screen would turn on when
			 * a charger is connected
			 */
			if (TRIGGER_SOFF)
				start_all_gc_threads();
			queue_work(system_power_efficient_wq, &f2fs_gc_fb_worker);
			break;
		case FB_BLANK_UNBLANK:
			screen_on = true;
			stop_all_gc_threads();
			queue_work(system_power_efficient_wq, &f2fs_gc_fb_worker);
			break;
		}
	}
@@ -297,6 +307,7 @@ static struct notifier_block fb_notifier_block = {

static int __init f2fs_gc_register_fb(void)
{
	INIT_WORK(&f2fs_gc_fb_worker, f2fs_gc_fb_work);
	fb_register_client(&fb_notifier_block);

	return 0;