diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-05-17 13:36:58 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-05-24 00:07:18 -0400 |
commit | 1d7be2708277edfef95171d52fb65ee26eaa076b (patch) | |
tree | 84cc7366fb88e361cfe381238748744764b349ab /fs/f2fs/segment.c | |
parent | b7b7c4cf1c9ef0272a65f1480457cbfdadcda19d (diff) |
f2fs: try to freeze in gc and discard threads
This allows to freeze gc and discard threads.
Cc: stable@vger.kernel.org
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 3bc36769ec9f..4591239dbae2 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kthread.h> | 16 | #include <linux/kthread.h> |
17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
18 | #include <linux/timer.h> | 18 | #include <linux/timer.h> |
19 | #include <linux/freezer.h> | ||
19 | 20 | ||
20 | #include "f2fs.h" | 21 | #include "f2fs.h" |
21 | #include "segment.h" | 22 | #include "segment.h" |
@@ -1059,18 +1060,24 @@ static int issue_discard_thread(void *data) | |||
1059 | struct f2fs_sb_info *sbi = data; | 1060 | struct f2fs_sb_info *sbi = data; |
1060 | struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; | 1061 | struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; |
1061 | wait_queue_head_t *q = &dcc->discard_wait_queue; | 1062 | wait_queue_head_t *q = &dcc->discard_wait_queue; |
1062 | repeat: | ||
1063 | if (kthread_should_stop()) | ||
1064 | return 0; | ||
1065 | 1063 | ||
1066 | __issue_discard_cmd(sbi, true); | 1064 | set_freezable(); |
1067 | __wait_discard_cmd(sbi, true); | ||
1068 | 1065 | ||
1069 | congestion_wait(BLK_RW_SYNC, HZ/50); | 1066 | do { |
1067 | wait_event_interruptible(*q, kthread_should_stop() || | ||
1068 | freezing(current) || | ||
1069 | atomic_read(&dcc->discard_cmd_cnt)); | ||
1070 | if (try_to_freeze()) | ||
1071 | continue; | ||
1072 | if (kthread_should_stop()) | ||
1073 | return 0; | ||
1070 | 1074 | ||
1071 | wait_event_interruptible(*q, kthread_should_stop() || | 1075 | __issue_discard_cmd(sbi, true); |
1072 | atomic_read(&dcc->discard_cmd_cnt)); | 1076 | __wait_discard_cmd(sbi, true); |
1073 | goto repeat; | 1077 | |
1078 | congestion_wait(BLK_RW_SYNC, HZ/50); | ||
1079 | } while (!kthread_should_stop()); | ||
1080 | return 0; | ||
1074 | } | 1081 | } |
1075 | 1082 | ||
1076 | #ifdef CONFIG_BLK_DEV_ZONED | 1083 | #ifdef CONFIG_BLK_DEV_ZONED |