Commit 5f656541 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: issue discard commands if gc_urgent is set

It's time to issue all the discard commands, if user sets the idle time.
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 969d1b18
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "f2fs.h" #include "f2fs.h"
#include "segment.h" #include "segment.h"
#include "node.h" #include "node.h"
#include "gc.h"
#include "trace.h" #include "trace.h"
#include <trace/events/f2fs.h> #include <trace/events/f2fs.h>
...@@ -1194,8 +1195,11 @@ static int issue_discard_thread(void *data) ...@@ -1194,8 +1195,11 @@ static int issue_discard_thread(void *data)
if (kthread_should_stop()) if (kthread_should_stop())
return 0; return 0;
if (dcc->discard_wake) if (dcc->discard_wake) {
dcc->discard_wake = 0; dcc->discard_wake = 0;
if (sbi->gc_thread && sbi->gc_thread->gc_urgent)
mark_discard_range_all(sbi);
}
sb_start_intwrite(sbi->sb); sb_start_intwrite(sbi->sb);
......
...@@ -178,8 +178,13 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a, ...@@ -178,8 +178,13 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
if (!strcmp(a->attr.name, "iostat_enable") && *ui == 0) if (!strcmp(a->attr.name, "iostat_enable") && *ui == 0)
f2fs_reset_iostat(sbi); f2fs_reset_iostat(sbi);
if (!strcmp(a->attr.name, "gc_urgent") && t == 1 && sbi->gc_thread) { if (!strcmp(a->attr.name, "gc_urgent") && t == 1 && sbi->gc_thread) {
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
sbi->gc_thread->gc_wake = 1; sbi->gc_thread->gc_wake = 1;
wake_up_interruptible_all(&sbi->gc_thread->gc_wait_queue_head); wake_up_interruptible_all(&sbi->gc_thread->gc_wait_queue_head);
dcc->discard_wake = 1;
wake_up_interruptible_all(&dcc->discard_wait_queue);
} }
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment