fsck.f2fs: check total_segments from devices in raw_super
A message that is not in the archive (sent off-list or not yet received): [email protected]
Chao Yu
Reviewed-by+Cc f2fs mailing list
Quoted 6 lines · sunqiuyang
From: Qiuyang Sun <[email protected]>
For multi-device F2FS, we should check if the sum of
total_segmentsfrom all devices matchessegment_count.Signed-off-by Qiuyang Sun <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,
Quoted 21 lines
--- fsck/mount.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)fsck/mount.c +8
-0@@ -782,6 +782,21 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, enum SB_ADDR sb_addr)return 1 ; } +if (sb->devs[0 ].path[0 ]) { +unsigned int dev_segs =le32_to_cpu (sb->devs[0 ].total_segments); +int i =1 ; + +while (i <MAX_DEVICES && sb->devs[i].path[0 ]) { + dev_segs +=le32_to_cpu (sb->devs[i].total_segments); + i++; + }
fsck/mount.c int sanity_check_raw_super(struct f2fs_super_block *sb, enum SB_ADDR sb_addr) · line 802
Quoted 10 lines
fsck/mount.c +7
-0+if (segment_count != dev_segs) { +MSG (0 ,"Segment count (%u) mismatch with total segments from devices (%u)" , + segment_count, dev_segs); +return 1 ; + } + } +if (secs_per_zone > total_sections || !secs_per_zone) {MSG (0 ,"Wrong secs_per_zone / total_sections (%u, %u)\n" , secs_per_zone, total_sections);
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel