summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorSahitya Tummala <stummala@codeaurora.org>2018-09-19 14:18:47 +0530
committerJaegeuk Kim <jaegeuk@kernel.org>2018-09-19 15:55:14 -0700
commita7d10cf3e4e3e308da01462a1ef8008233ee523d (patch)
treee9efbbc09c649b95ae5d51bdbd388e472c472b3a /fs/f2fs/segment.c
parent6f5c2ed0a26fae6904a88622c126dfb9369548a3 (diff)
downloadlinux-stable-a7d10cf3e4e3e308da01462a1ef8008233ee523d.tar.gz
linux-stable-a7d10cf3e4e3e308da01462a1ef8008233ee523d.tar.bz2
linux-stable-a7d10cf3e4e3e308da01462a1ef8008233ee523d.zip
f2fs: add new idle interval timing for discard and gc paths
This helps to control the frequency of submission of discard and GC requests independently, based on the need. Suggested-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 9a8d7d415a74..97a4fae75651 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -508,7 +508,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi)
else
f2fs_build_free_nids(sbi, false, false);
- if (!is_idle(sbi) &&
+ if (!is_idle(sbi, REQ_TIME) &&
(!excess_dirty_nats(sbi) && !excess_dirty_nodes(sbi)))
return;
@@ -1308,7 +1308,7 @@ static unsigned int __issue_discard_cmd_orderly(struct f2fs_sb_info *sbi,
if (dc->state != D_PREP)
goto next;
- if (dpolicy->io_aware && !is_idle(sbi)) {
+ if (dpolicy->io_aware && !is_idle(sbi, DISCARD_TIME)) {
io_interrupted = true;
break;
}
@@ -1368,7 +1368,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
f2fs_bug_on(sbi, dc->state != D_PREP);
if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
- !is_idle(sbi)) {
+ !is_idle(sbi, DISCARD_TIME)) {
io_interrupted = true;
break;
}
@@ -1561,8 +1561,6 @@ static int issue_discard_thread(void *data)
struct discard_policy dpolicy;
unsigned int wait_ms = DEF_MIN_DISCARD_ISSUE_TIME;
int issued;
- unsigned long interval = sbi->interval_time[REQ_TIME] * HZ;
- long delta;
set_freezable();
@@ -1599,10 +1597,8 @@ static int issue_discard_thread(void *data)
__wait_all_discard_cmd(sbi, &dpolicy);
wait_ms = dpolicy.min_interval;
} else if (issued == -1){
- delta = (sbi->last_time[REQ_TIME] + interval) - jiffies;
- if (delta > 0)
- wait_ms = jiffies_to_msecs(delta);
- else
+ wait_ms = f2fs_time_to_wait(sbi, DISCARD_TIME);
+ if (!wait_ms)
wait_ms = dpolicy.mid_interval;
} else {
wait_ms = dpolicy.max_interval;