summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorZhikang Zhang <zhangzhikang1@huawei.com>2018-04-09 04:28:41 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-31 11:31:46 -0700
commit56b07e7e65503cec9e8d74507937a3809dddd48f (patch)
tree85c383b0c4fa664f36d5e059d51ace9d1c049135 /fs/f2fs
parent3d165dc3aeef0c9cca7dd760a09f7d08aab0eef2 (diff)
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: Zhikang Zhang <zhangzhikang1@huawei.com> Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 08b8f2d4faef..e22911f2a378 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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);