summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-01-08 05:48:33 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2018-01-16 18:40:00 -0500
commit49c60c67d235647c0bec7c68982539f3a6e8bbcd (patch)
tree73ff723b4158094dcab5c70403fa83411dab9977 /fs/f2fs
parent94b1e10e745424fe6183023ff5a525bf7d12f779 (diff)
f2fs: avoid high cpu usage in discard thread
We take very long time to finish generic/476, this is because we will check consistence of all discard entries in global rb tree while traversing all different granularity pending lists, even when the list is empty, in order to avoid that unneeded overhead, we have to skip the check when coming up an empty list. generic/476 time consumption: cost Before patch & w/o consistence check 57s Before patch & w/ consistence check 1426s After patch 78s Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b4b90980dc7b..35009dbacd46 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1204,6 +1204,8 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
1204 pend_list = &dcc->pend_list[i]; 1204 pend_list = &dcc->pend_list[i];
1205 1205
1206 mutex_lock(&dcc->cmd_lock); 1206 mutex_lock(&dcc->cmd_lock);
1207 if (list_empty(pend_list))
1208 goto next;
1207 f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root)); 1209 f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
1208 blk_start_plug(&plug); 1210 blk_start_plug(&plug);
1209 list_for_each_entry_safe(dc, tmp, pend_list, list) { 1211 list_for_each_entry_safe(dc, tmp, pend_list, list) {
@@ -1222,6 +1224,7 @@ skip:
1222 break; 1224 break;
1223 } 1225 }
1224 blk_finish_plug(&plug); 1226 blk_finish_plug(&plug);
1227next:
1225 mutex_unlock(&dcc->cmd_lock); 1228 mutex_unlock(&dcc->cmd_lock);
1226 1229
1227 if (iter >= dpolicy->max_requests) 1230 if (iter >= dpolicy->max_requests)