提交 56b07e7e 编写于 作者: Z Zhikang Zhang 提交者: Jaegeuk Kim

f2fs: check cur_valid_map_mir & raw_sit block count when flush sit entries

We should check valid_map_mir and block count to ensure
the flushed raw_sit is correct.
Signed-off-by: NZhikang Zhang <zhangzhikang1@huawei.com>
Signed-off-by: NYunlei He <heyunlei@huawei.com>
Reviewed-by: NChao Yu <yuchao0@huawei.com>
Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
上级 3d165dc3
......@@ -3400,6 +3400,11 @@ void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
int offset, sit_offset;
se = get_seg_entry(sbi, segno);
#ifdef CONFIG_F2FS_CHECK_FS
if (memcmp(se->cur_valid_map, se->cur_valid_map_mir,
SIT_VBLOCK_MAP_SIZE))
f2fs_bug_on(sbi, 1);
#endif
/* add discard candidates */
if (!(cpc->reason & CP_DISCARD)) {
......@@ -3415,10 +3420,14 @@ void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
cpu_to_le32(segno);
seg_info_to_raw_sit(se,
&sit_in_journal(journal, offset));
check_block_count(sbi, segno,
&sit_in_journal(journal, offset));
} else {
sit_offset = SIT_ENTRY_OFFSET(sit_i, segno);
seg_info_to_raw_sit(se,
&raw_sit->entries[sit_offset]);
check_block_count(sbi, segno,
&raw_sit->entries[sit_offset]);
}
__clear_bit(segno, bitmap);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册