提交 40a02be1 编写于 作者: J Jaegeuk Kim

f2fs: do not issue next dnode discard redundantly

We have a discard map, so that we can avoid redundant discard issues.
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 498c5e9f
...@@ -486,7 +486,20 @@ static int f2fs_issue_discard(struct f2fs_sb_info *sbi, ...@@ -486,7 +486,20 @@ static int f2fs_issue_discard(struct f2fs_sb_info *sbi,
void discard_next_dnode(struct f2fs_sb_info *sbi, block_t blkaddr) void discard_next_dnode(struct f2fs_sb_info *sbi, block_t blkaddr)
{ {
if (f2fs_issue_discard(sbi, blkaddr, 1)) { int err = -ENOTSUPP;
if (test_opt(sbi, DISCARD)) {
struct seg_entry *se = get_seg_entry(sbi,
GET_SEGNO(sbi, blkaddr));
unsigned int offset = GET_BLKOFF_FROM_SEG0(sbi, blkaddr);
if (f2fs_test_bit(offset, se->discard_map))
return;
err = f2fs_issue_discard(sbi, blkaddr, 1);
}
if (err) {
struct page *page = grab_meta_page(sbi, blkaddr); struct page *page = grab_meta_page(sbi, blkaddr);
/* zero-filled page */ /* zero-filled page */
set_page_dirty(page); set_page_dirty(page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册