fsck.f2fs: support to fix inconsistent sit->type of segments in large section
PATCH 1/1 fsck.f2fs: support to fix inconsistent sit->type of segments in large section
fsck.f2fs -d1 <device>
[fix_section_type:3036] wrong sit->type (4) in DATA secno:1 segno:2 [fix_section_type:3036] wrong sit->type (4) in DATA secno:5 segno:11
fsck.f2fs -f <device>
[FIX] (fix_section_type:3040) --> Fix wrong sit->type (4 -> 2) in DATA secno (1), totally 2 empty segment(s) [FIX] (fix_section_type:3050) --> Fix wrong sit->type in DATA secno (1), totally 1 empty segment(s) [FIX] (fix_section_type:3040) --> Fix wrong sit->type (4 -> 2) in DATA secno (5), totally 11 empty segment(s) [FIX] (fix_section_type:3050) --> Fix wrong sit->type in DATA secno (5), totally 1 empty segment(s)
Now it can only fix wrong sit->type of segment from NODE to DATA in a DATA section, such inconsistent image can be generated by recovery.
For fuzzed image which contains below inconsistent sit->type, we can support to detect and repair later:
1) empty NODE segment in DATA section (FIXED w/ current patch)
2) empty DATA segment in NODE section
3) valid segments w/ different temperature in DATA section
4) valid segments w/ different temperature in NODE section
5) valid segments w/ different sit->type in section
--- fsck/f2fs.h | 13 ++++++++ fsck/fsck.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+)
fsck/f2fs.h +13 -0
@@ -572,6 +572,19 @@ static inline int IS_CUR_SEGNO(struct f2fs_sb_info *sbi, u32 segno)return 0 ; } +static inline int IS_CUR_SECNO (struct f2fs_sb_info *sbi,u32 secno) +{ +int i; + +for (i =0 ; i <NO_CHECK_TYPE ; i++) { +struct curseg_info *curseg =CURSEG_I (sbi, i); + +if (secno ==GET_SEC_FROM_SEG (sbi, curseg->segno)) +return 1 ; + } +return 0 ; +} +static inline u64 BLKOFF_FROM_MAIN (struct f2fs_sb_info *sbi,u64 blk_addr) {ASSERT (blk_addr >=SM_I (sbi)->main_blkaddr);
fsck/fsck.c +94 -0
106 lines not on this page · raw message
Signature · 8 lines
2.49.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel