[PATCH 3.16 010/192] f2fs: try to freeze in gc and discard threads

From: Ben Hutchings
Date: Mon Oct 09 2017 - 09:04:32 EST


3.16.49-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>

commit 1d7be2708277edfef95171d52fb65ee26eaa076b upstream.

This allows to freeze gc and discard threads.

Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
[bwh: Backported to 3.16: drop changes to discard thread]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -35,13 +35,14 @@ static int gc_thread_func(void *data)

wait_ms = gc_th->min_sleep_time;

+ set_freezable();
do {
+ wait_event_interruptible_timeout(*wq,
+ kthread_should_stop() || freezing(current),
+ msecs_to_jiffies(wait_ms));
+
if (try_to_freeze())
continue;
- else
- wait_event_interruptible_timeout(*wq,
- kthread_should_stop(),
- msecs_to_jiffies(wait_ms));
if (kthread_should_stop())
break;