summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-06-22 04:06:59 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2018-07-27 05:03:59 -0400
commit67fce70ba341f772073cac9c3044aa98c69b24fb (patch)
tree84a8f0b4254a9d6b98bc3dede5b7647778d0f3d0 /fs/f2fs/segment.c
parente1da7872f6eda977bd812346bf588c35e4495a1e (diff)
f2fs: disable f2fs_check_rb_tree_consistence
If there is millions of discard entries cached in rb tree, each sanity check of it can cause very long latency as held cmd_lock blocking other lock grabbers. In other aspect, we have enabled the check very long time, as we see, there is no such inconsistent condition caused by bugs. But still we do not choose to kill it directly, instead, adding an flag to disable the check now, if there is related code change, we can reuse it to detect bugs. Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 654091ec9cfe..d63d89287c53 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1199,8 +1199,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
1199 mutex_lock(&dcc->cmd_lock); 1199 mutex_lock(&dcc->cmd_lock);
1200 if (list_empty(pend_list)) 1200 if (list_empty(pend_list))
1201 goto next; 1201 goto next;
1202 f2fs_bug_on(sbi, 1202 if (unlikely(dcc->rbtree_check))
1203 !f2fs_check_rb_tree_consistence(sbi, &dcc->root)); 1203 f2fs_bug_on(sbi, !f2fs_check_rb_tree_consistence(sbi,
1204 &dcc->root));
1204 blk_start_plug(&plug); 1205 blk_start_plug(&plug);
1205 list_for_each_entry_safe(dc, tmp, pend_list, list) { 1206 list_for_each_entry_safe(dc, tmp, pend_list, list) {
1206 f2fs_bug_on(sbi, dc->state != D_PREP); 1207 f2fs_bug_on(sbi, dc->state != D_PREP);
@@ -1752,6 +1753,7 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
1752 dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg; 1753 dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg;
1753 dcc->undiscard_blks = 0; 1754 dcc->undiscard_blks = 0;
1754 dcc->root = RB_ROOT; 1755 dcc->root = RB_ROOT;
1756 dcc->rbtree_check = false;
1755 1757
1756 init_waitqueue_head(&dcc->discard_wait_queue); 1758 init_waitqueue_head(&dcc->discard_wait_queue);
1757 SM_I(sbi)->dcc_info = dcc; 1759 SM_I(sbi)->dcc_info = dcc;
@@ -2381,7 +2383,9 @@ next:
2381 issued = 0; 2383 issued = 0;
2382 2384
2383 mutex_lock(&dcc->cmd_lock); 2385 mutex_lock(&dcc->cmd_lock);
2384 f2fs_bug_on(sbi, !f2fs_check_rb_tree_consistence(sbi, &dcc->root)); 2386 if (unlikely(dcc->rbtree_check))
2387 f2fs_bug_on(sbi, !f2fs_check_rb_tree_consistence(sbi,
2388 &dcc->root));
2385 2389
2386 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root, 2390 dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root,
2387 NULL, start, 2391 NULL, start,