* [PATCH] f2fs: combine huge num of discard rb tree consistence checks
@ 2017-05-19 6:42 Yunlei He
0 siblings, 0 replies; 3+ messages in thread
From: Yunlei He @ 2017-05-19 6:42 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel
Came across a hungtask caused by huge number of rb tree traversing
during adding discard addrs in cp. This patch combine these consistence
checks and move it to discard thread.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/segment.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 5045450..2624e01 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -837,7 +837,6 @@ static void __punch_discard_cmd(struct f2fs_sb_info *sbi,
dc->len = blkaddr - dc->lstart;
dcc->undiscard_blks += dc->len;
__relocate_discard_cmd(dcc, dc);
- f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
modified = true;
}
@@ -847,16 +846,12 @@ static void __punch_discard_cmd(struct f2fs_sb_info *sbi,
di.start + blkaddr + 1 - di.lstart,
di.lstart + di.len - 1 - blkaddr,
NULL, NULL);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
} else {
dc->lstart++;
dc->len--;
dc->start++;
dcc->undiscard_blks += dc->len;
__relocate_discard_cmd(dcc, dc);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
}
}
}
@@ -917,8 +912,6 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
prev_dc->di.len += di.len;
dcc->undiscard_blks += di.len;
__relocate_discard_cmd(dcc, prev_dc);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
di = prev_dc->di;
tdc = prev_dc;
merged = true;
@@ -934,16 +927,12 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
__relocate_discard_cmd(dcc, next_dc);
if (tdc)
__remove_discard_cmd(sbi, tdc);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
merged = true;
}
if (!merged) {
__insert_discard_tree(sbi, bdev, di.lstart, di.start,
di.len, NULL, NULL);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
}
next:
prev_dc = next_dc;
@@ -982,6 +971,8 @@ static void __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
int i, iter = 0;
mutex_lock(&dcc->cmd_lock);
+ f2fs_bug_on(sbi,
+ !__check_rb_tree_consistence(sbi, &dcc->root));
blk_start_plug(&plug);
for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
pend_list = &dcc->pend_list[i];
--
1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: combine huge num of discard rb tree consistence checks
2017-05-15 10:01 Yunlei He
@ 2017-05-15 11:20 ` Chao Yu
0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2017-05-15 11:20 UTC (permalink / raw)
To: Yunlei He, jaegeuk, linux-f2fs-devel
On 2017/5/15 18:01, Yunlei He wrote:
> Came across a hungtask caused by huge number of rb tree traversing
> during adding discard addrs in cp. This patch combine these consistence
> checks and move it to discard thread.
Need to remove all __check_rb_tree_consistence in __update_discard_tree_range.
Thanks,
>
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
> fs/f2fs/segment.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index de31030..878ac90 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -918,8 +918,6 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
> prev_dc->di.len += di.len;
> dcc->undiscard_blks += di.len;
> __relocate_discard_cmd(dcc, prev_dc);
> - f2fs_bug_on(sbi,
> - !__check_rb_tree_consistence(sbi, &dcc->root));
> di = prev_dc->di;
> tdc = prev_dc;
> merged = true;
> @@ -935,16 +933,12 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
> __relocate_discard_cmd(dcc, next_dc);
> if (tdc)
> __remove_discard_cmd(sbi, tdc);
> - f2fs_bug_on(sbi,
> - !__check_rb_tree_consistence(sbi, &dcc->root));
> merged = true;
> }
>
> if (!merged) {
> __insert_discard_tree(sbi, bdev, di.lstart, di.start,
> di.len, NULL, NULL);
> - f2fs_bug_on(sbi,
> - !__check_rb_tree_consistence(sbi, &dcc->root));
> }
> next:
> prev_dc = next_dc;
> @@ -983,6 +977,8 @@ static void __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
> int i, iter = 0;
>
> mutex_lock(&dcc->cmd_lock);
> + f2fs_bug_on(sbi,
> + !__check_rb_tree_consistence(sbi, &dcc->root));
> blk_start_plug(&plug);
> for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
> pend_list = &dcc->pend_list[i];
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] f2fs: combine huge num of discard rb tree consistence checks
@ 2017-05-15 10:01 Yunlei He
2017-05-15 11:20 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Yunlei He @ 2017-05-15 10:01 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel
Came across a hungtask caused by huge number of rb tree traversing
during adding discard addrs in cp. This patch combine these consistence
checks and move it to discard thread.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/segment.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index de31030..878ac90 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -918,8 +918,6 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
prev_dc->di.len += di.len;
dcc->undiscard_blks += di.len;
__relocate_discard_cmd(dcc, prev_dc);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
di = prev_dc->di;
tdc = prev_dc;
merged = true;
@@ -935,16 +933,12 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
__relocate_discard_cmd(dcc, next_dc);
if (tdc)
__remove_discard_cmd(sbi, tdc);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
merged = true;
}
if (!merged) {
__insert_discard_tree(sbi, bdev, di.lstart, di.start,
di.len, NULL, NULL);
- f2fs_bug_on(sbi,
- !__check_rb_tree_consistence(sbi, &dcc->root));
}
next:
prev_dc = next_dc;
@@ -983,6 +977,8 @@ static void __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
int i, iter = 0;
mutex_lock(&dcc->cmd_lock);
+ f2fs_bug_on(sbi,
+ !__check_rb_tree_consistence(sbi, &dcc->root));
blk_start_plug(&plug);
for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
pend_list = &dcc->pend_list[i];
--
1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-19 6:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 6:42 [PATCH] f2fs: combine huge num of discard rb tree consistence checks Yunlei He
-- strict thread matches above, loose matches on Subject: below --
2017-05-15 10:01 Yunlei He
2017-05-15 11:20 ` Chao Yu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.