|
|
@@ -2329,7 +2329,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi)
|
|
|
unsigned int segment_count_main;
|
|
|
unsigned int cp_pack_start_sum, cp_payload;
|
|
|
block_t user_block_count;
|
|
|
- int i;
|
|
|
+ int i, j;
|
|
|
|
|
|
total = le32_to_cpu(raw_super->segment_count);
|
|
|
fsmeta = le32_to_cpu(raw_super->segment_count_ckpt);
|
|
|
@@ -2370,11 +2370,43 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi)
|
|
|
if (le32_to_cpu(ckpt->cur_node_segno[i]) >= main_segs ||
|
|
|
le16_to_cpu(ckpt->cur_node_blkoff[i]) >= blocks_per_seg)
|
|
|
return 1;
|
|
|
+ for (j = i + 1; j < NR_CURSEG_NODE_TYPE; j++) {
|
|
|
+ if (le32_to_cpu(ckpt->cur_node_segno[i]) ==
|
|
|
+ le32_to_cpu(ckpt->cur_node_segno[j])) {
|
|
|
+ f2fs_msg(sbi->sb, KERN_ERR,
|
|
|
+ "Node segment (%u, %u) has the same "
|
|
|
+ "segno: %u", i, j,
|
|
|
+ le32_to_cpu(ckpt->cur_node_segno[i]));
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
for (i = 0; i < NR_CURSEG_DATA_TYPE; i++) {
|
|
|
if (le32_to_cpu(ckpt->cur_data_segno[i]) >= main_segs ||
|
|
|
le16_to_cpu(ckpt->cur_data_blkoff[i]) >= blocks_per_seg)
|
|
|
return 1;
|
|
|
+ for (j = i + 1; j < NR_CURSEG_DATA_TYPE; j++) {
|
|
|
+ if (le32_to_cpu(ckpt->cur_data_segno[i]) ==
|
|
|
+ le32_to_cpu(ckpt->cur_data_segno[j])) {
|
|
|
+ f2fs_msg(sbi->sb, KERN_ERR,
|
|
|
+ "Data segment (%u, %u) has the same "
|
|
|
+ "segno: %u", i, j,
|
|
|
+ le32_to_cpu(ckpt->cur_data_segno[i]));
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) {
|
|
|
+ for (j = i; j < NR_CURSEG_DATA_TYPE; j++) {
|
|
|
+ if (le32_to_cpu(ckpt->cur_node_segno[i]) ==
|
|
|
+ le32_to_cpu(ckpt->cur_data_segno[j])) {
|
|
|
+ f2fs_msg(sbi->sb, KERN_ERR,
|
|
|
+ "Data segment (%u) and Data segment (%u)"
|
|
|
+ " has the same segno: %u", i, j,
|
|
|
+ le32_to_cpu(ckpt->cur_node_segno[i]));
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
sit_bitmap_size = le32_to_cpu(ckpt->sit_ver_bitmap_bytesize);
|