f2fs: do not change the valid_block value if cur_valid_map was wrongly set or cleared

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Yunlong Song 2017-08-02 22:16:54 +08:00 committed by Jaegeuk Kim
parent f18ec06e50
commit 98407fc7a0

View file

@ -1618,6 +1618,8 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
f2fs_msg(sbi->sb, KERN_ERR, f2fs_msg(sbi->sb, KERN_ERR,
"Bitmap was wrongly set, blk:%u", blkaddr); "Bitmap was wrongly set, blk:%u", blkaddr);
f2fs_bug_on(sbi, 1); f2fs_bug_on(sbi, 1);
se->valid_blocks--;
del = 0;
} }
if (f2fs_discard_en(sbi) && if (f2fs_discard_en(sbi) &&
@ -1645,6 +1647,8 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
f2fs_msg(sbi->sb, KERN_ERR, f2fs_msg(sbi->sb, KERN_ERR,
"Bitmap was wrongly cleared, blk:%u", blkaddr); "Bitmap was wrongly cleared, blk:%u", blkaddr);
f2fs_bug_on(sbi, 1); f2fs_bug_on(sbi, 1);
se->valid_blocks++;
del = 0;
} }
if (f2fs_discard_en(sbi) && if (f2fs_discard_en(sbi) &&