Lines Matching refs:sbi

19 int f2fs_set_main_bitmap(struct f2fs_sb_info *sbi, u32 blk, int type)  in f2fs_set_main_bitmap()  argument
21 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in f2fs_set_main_bitmap()
25 se = get_seg_entry(sbi, GET_SEGNO(sbi, blk)); in f2fs_set_main_bitmap()
34 GET_SEGNO(sbi, blk), se->type, type); in f2fs_set_main_bitmap()
37 return f2fs_set_bit(BLKOFF_FROM_MAIN(sbi, blk), fsck->main_area_bitmap); in f2fs_set_main_bitmap()
40 static inline int f2fs_test_main_bitmap(struct f2fs_sb_info *sbi, u32 blk) in f2fs_test_main_bitmap() argument
42 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in f2fs_test_main_bitmap()
44 return f2fs_test_bit(BLKOFF_FROM_MAIN(sbi, blk), in f2fs_test_main_bitmap()
48 static inline int f2fs_clear_main_bitmap(struct f2fs_sb_info *sbi, u32 blk) in f2fs_clear_main_bitmap() argument
50 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in f2fs_clear_main_bitmap()
52 return f2fs_clear_bit(BLKOFF_FROM_MAIN(sbi, blk), in f2fs_clear_main_bitmap()
56 static inline int f2fs_test_sit_bitmap(struct f2fs_sb_info *sbi, u32 blk) in f2fs_test_sit_bitmap() argument
58 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in f2fs_test_sit_bitmap()
60 return f2fs_test_bit(BLKOFF_FROM_MAIN(sbi, blk), fsck->sit_area_bitmap); in f2fs_test_sit_bitmap()
63 int f2fs_set_sit_bitmap(struct f2fs_sb_info *sbi, u32 blk) in f2fs_set_sit_bitmap() argument
65 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in f2fs_set_sit_bitmap()
67 return f2fs_set_bit(BLKOFF_FROM_MAIN(sbi, blk), fsck->sit_area_bitmap); in f2fs_set_sit_bitmap()
70 static int add_into_hard_link_list(struct f2fs_sb_info *sbi, in add_into_hard_link_list() argument
73 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in add_into_hard_link_list()
111 static int find_and_dec_hard_link_list(struct f2fs_sb_info *sbi, u32 nid) in find_and_dec_hard_link_list() argument
113 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in find_and_dec_hard_link_list()
144 static int is_valid_ssa_node_blk(struct f2fs_sb_info *sbi, u32 nid, in is_valid_ssa_node_blk() argument
154 segno = GET_SEGNO(sbi, blk_addr); in is_valid_ssa_node_blk()
155 offset = OFFSET_IN_SEG(sbi, blk_addr); in is_valid_ssa_node_blk()
157 sum_blk = get_sum_block(sbi, segno, &type); in is_valid_ssa_node_blk()
168 se = get_seg_entry(sbi, segno); in is_valid_ssa_node_blk()
185 GET_SUM_BLKADDR(sbi, in is_valid_ssa_node_blk()
186 GET_SEGNO(sbi, blk_addr))); in is_valid_ssa_node_blk()
188 GET_SEGNO(sbi, blk_addr), in is_valid_ssa_node_blk()
189 OFFSET_IN_SEG(sbi, blk_addr)); in is_valid_ssa_node_blk()
206 ssa_blk = GET_SUM_BLKADDR(sbi, segno); in is_valid_ssa_node_blk()
217 static int is_valid_summary(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, in is_valid_summary() argument
230 if (!IS_VALID_NID(sbi, nid)) in is_valid_summary()
233 get_node_info(sbi, nid, &ni); in is_valid_summary()
235 if (!IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) in is_valid_summary()
261 static int is_valid_ssa_data_blk(struct f2fs_sb_info *sbi, u32 blk_addr, in is_valid_ssa_data_blk() argument
271 segno = GET_SEGNO(sbi, blk_addr); in is_valid_ssa_data_blk()
272 offset = OFFSET_IN_SEG(sbi, blk_addr); in is_valid_ssa_data_blk()
274 sum_blk = get_sum_block(sbi, segno, &type); in is_valid_ssa_data_blk()
285 se = get_seg_entry(sbi, segno); in is_valid_ssa_data_blk()
316 } else if (is_valid_summary(sbi, sum_entry, blk_addr)) { in is_valid_ssa_data_blk()
332 ssa_blk = GET_SUM_BLKADDR(sbi, segno); in is_valid_ssa_data_blk()
377 static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid, in sanity_check_nid() argument
382 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in sanity_check_nid()
385 if (!IS_VALID_NID(sbi, nid)) { in sanity_check_nid()
390 get_node_info(sbi, nid, ni); in sanity_check_nid()
401 if (!IS_VALID_BLK_ADDR(sbi, ni->blk_addr)) { in sanity_check_nid()
449 if (f2fs_test_main_bitmap(sbi, ni->blk_addr) != 0) { in sanity_check_nid()
469 f2fs_set_bit(nid, NM_I(sbi)->nid_bitmap); in sanity_check_nid()
474 if (is_valid_ssa_node_blk(sbi, nid, ni->blk_addr)) { in sanity_check_nid()
479 if (f2fs_test_sit_bitmap(sbi, ni->blk_addr) == 0) in sanity_check_nid()
483 if (f2fs_test_main_bitmap(sbi, ni->blk_addr) == 0) { in sanity_check_nid()
490 static int fsck_chk_xattr_blk(struct f2fs_sb_info *sbi, u32 ino, in fsck_chk_xattr_blk() argument
504 if (sanity_check_nid(sbi, x_nid, node_blk, in fsck_chk_xattr_blk()
511 f2fs_set_main_bitmap(sbi, ni.blk_addr, CURSEG_COLD_NODE); in fsck_chk_xattr_blk()
518 int fsck_chk_node_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode, in fsck_chk_node_blk() argument
528 if (sanity_check_nid(sbi, nid, node_blk, ftype, ntype, &ni)) in fsck_chk_node_blk()
532 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_node_blk()
534 fsck_chk_inode_blk(sbi, nid, ftype, node_blk, blk_cnt, &ni, child); in fsck_chk_node_blk()
539 f2fs_set_main_bitmap(sbi, ni.blk_addr, in fsck_chk_node_blk()
541 fsck_chk_dnode_blk(sbi, inode, nid, ftype, node_blk, in fsck_chk_node_blk()
545 f2fs_set_main_bitmap(sbi, ni.blk_addr, in fsck_chk_node_blk()
547 fsck_chk_idnode_blk(sbi, inode, ftype, node_blk, in fsck_chk_node_blk()
551 f2fs_set_main_bitmap(sbi, ni.blk_addr, in fsck_chk_node_blk()
553 fsck_chk_didnode_blk(sbi, inode, ftype, node_blk, in fsck_chk_node_blk()
628 void fsck_reada_node_block(struct f2fs_sb_info *sbi, u32 nid) in fsck_reada_node_block() argument
632 if (nid != 0 && IS_VALID_NID(sbi, nid)) { in fsck_reada_node_block()
633 get_node_info(sbi, nid, &ni); in fsck_reada_node_block()
634 if (IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) in fsck_reada_node_block()
639 void fsck_reada_all_direct_node_blocks(struct f2fs_sb_info *sbi, in fsck_reada_all_direct_node_blocks() argument
647 fsck_reada_node_block(sbi, nid); in fsck_reada_all_direct_node_blocks()
652 void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, in fsck_chk_inode_blk() argument
656 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_inode_blk()
676 if (f2fs_test_main_bitmap(sbi, ni->blk_addr) == 0) in fsck_chk_inode_blk()
680 f2fs_set_main_bitmap(sbi, ni->blk_addr, CURSEG_HOT_NODE); in fsck_chk_inode_blk()
682 if (f2fs_test_main_bitmap(sbi, ni->blk_addr) == 0) { in fsck_chk_inode_blk()
683 f2fs_set_main_bitmap(sbi, ni->blk_addr, in fsck_chk_inode_blk()
686 !is_qf_ino(F2FS_RAW_SUPER(sbi), nid)) { in fsck_chk_inode_blk()
688 add_into_hard_link_list(sbi, nid, i_links); in fsck_chk_inode_blk()
693 if (find_and_dec_hard_link_list(sbi, nid)) { in fsck_chk_inode_blk()
712 fsck_reada_node_block(sbi, le32_to_cpu(node_blk->i.i_xattr_nid)); in fsck_chk_inode_blk()
714 if (fsck_chk_xattr_blk(sbi, nid, in fsck_chk_inode_blk()
809 ret = fsck_chk_inline_dentries(sbi, node_blk, &child); in fsck_chk_inode_blk()
827 ret = fsck_chk_data_blk(sbi, in fsck_chk_inode_blk()
846 fsck_reada_node_block(sbi, nid); in fsck_chk_inode_blk()
865 ret = fsck_chk_node_blk(sbi, &node_blk->i, i_nid, in fsck_chk_inode_blk()
937 if (is_qf_ino(F2FS_RAW_SUPER(sbi), nid)) in fsck_chk_inode_blk()
1047 int fsck_chk_dnode_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode, in fsck_chk_dnode_blk() argument
1063 ret = fsck_chk_data_blk(sbi, in fsck_chk_dnode_blk()
1083 int fsck_chk_idnode_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode, in fsck_chk_idnode_blk() argument
1090 fsck_reada_all_direct_node_blocks(sbi, node_blk); in fsck_chk_idnode_blk()
1095 ret = fsck_chk_node_blk(sbi, inode, in fsck_chk_idnode_blk()
1117 get_node_info(sbi, nid, &ni); in fsck_chk_idnode_blk()
1125 int fsck_chk_didnode_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode, in fsck_chk_didnode_blk() argument
1132 fsck_reada_all_direct_node_blocks(sbi, node_blk); in fsck_chk_didnode_blk()
1137 ret = fsck_chk_node_blk(sbi, inode, in fsck_chk_didnode_blk()
1159 get_node_info(sbi, nid, &ni); in fsck_chk_didnode_blk()
1319 static int __chk_dots_dentries(struct f2fs_sb_info *sbi, in __chk_dots_dentries() argument
1338 if (child->p_ino == F2FS_ROOT_INO(sbi)) { in __chk_dots_dentries()
1339 if (le32_to_cpu(dentry->ino) != F2FS_ROOT_INO(sbi)) { in __chk_dots_dentries()
1342 dentry->ino = cpu_to_le32(F2FS_ROOT_INO(sbi)); in __chk_dots_dentries()
1373 static int __chk_dentries(struct f2fs_sb_info *sbi, struct child_info *child, in __chk_dentries() argument
1378 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in __chk_dentries()
1398 if (IS_VALID_NID(sbi, ino)) { in __chk_dentries()
1401 get_node_info(sbi, ino, &ni); in __chk_dentries()
1402 if (IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) { in __chk_dentries()
1416 if (!IS_VALID_NID(sbi, le32_to_cpu(dentry[i].ino))) { in __chk_dentries()
1466 ret = __chk_dots_dentries(sbi, &dentry[i], in __chk_dentries()
1522 ret = fsck_chk_node_blk(sbi, in __chk_dentries()
1549 int fsck_chk_inline_dentries(struct f2fs_sb_info *sbi, in fsck_chk_inline_dentries() argument
1552 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_inline_dentries()
1563 dentries = __chk_dentries(sbi, child, in fsck_chk_inline_dentries()
1579 int fsck_chk_dentry_blk(struct f2fs_sb_info *sbi, u32 blk_addr, in fsck_chk_dentry_blk() argument
1582 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_dentry_blk()
1593 dentries = __chk_dentries(sbi, child, in fsck_chk_dentry_blk()
1614 int fsck_chk_data_blk(struct f2fs_sb_info *sbi, u32 blk_addr, in fsck_chk_data_blk() argument
1619 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_data_blk()
1627 if (!IS_VALID_BLK_ADDR(sbi, blk_addr)) { in fsck_chk_data_blk()
1632 if (is_valid_ssa_data_blk(sbi, blk_addr, parent_nid, in fsck_chk_data_blk()
1639 if (f2fs_test_sit_bitmap(sbi, blk_addr) == 0) in fsck_chk_data_blk()
1642 if (f2fs_test_main_bitmap(sbi, blk_addr) != 0) in fsck_chk_data_blk()
1649 f2fs_set_main_bitmap(sbi, blk_addr, CURSEG_HOT_DATA); in fsck_chk_data_blk()
1650 return fsck_chk_dentry_blk(sbi, blk_addr, child, in fsck_chk_data_blk()
1653 f2fs_set_main_bitmap(sbi, blk_addr, CURSEG_WARM_DATA); in fsck_chk_data_blk()
1658 int fsck_chk_orphan_node(struct f2fs_sb_info *sbi) in fsck_chk_orphan_node() argument
1663 struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); in fsck_chk_orphan_node()
1666 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG)) in fsck_chk_orphan_node()
1669 start_blk = __start_cp_addr(sbi) + 1 + get_sb(cp_payload); in fsck_chk_orphan_node()
1670 orphan_blkaddr = __start_sum_addr(sbi) - 1 - get_sb(cp_payload); in fsck_chk_orphan_node()
1692 get_node_info(sbi, ino, &ni); in fsck_chk_orphan_node()
1693 if (!IS_VALID_NID(sbi, ino) || in fsck_chk_orphan_node()
1694 !IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) in fsck_chk_orphan_node()
1700 ret = fsck_chk_node_blk(sbi, NULL, ino, in fsck_chk_orphan_node()
1726 int fsck_chk_quota_node(struct f2fs_sb_info *sbi) in fsck_chk_quota_node() argument
1728 struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); in fsck_chk_quota_node()
1743 get_node_info(sbi, ino, &ni); in fsck_chk_quota_node()
1744 if (!IS_VALID_NID(sbi, ino) || in fsck_chk_quota_node()
1745 !IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) in fsck_chk_quota_node()
1749 ret = fsck_chk_node_blk(sbi, NULL, ino, in fsck_chk_quota_node()
1758 int fsck_chk_quota_files(struct f2fs_sb_info *sbi) in fsck_chk_quota_files() argument
1760 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_quota_files()
1761 struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); in fsck_chk_quota_files()
1778 ret = quota_compare_and_update(sbi, qtype, &needs_writeout, in fsck_chk_quota_files()
1789 f2fs_filesize_update(sbi, ino, 0); in fsck_chk_quota_files()
1790 ret = quota_write_inode(sbi, qtype); in fsck_chk_quota_files()
1805 int fsck_chk_meta(struct f2fs_sb_info *sbi) in fsck_chk_meta() argument
1807 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_chk_meta()
1808 struct f2fs_checkpoint *cp = F2FS_CKPT(sbi); in fsck_chk_meta()
1814 for (i = 0; i < TOTAL_SEGS(sbi); i++) { in fsck_chk_meta()
1815 se = get_seg_entry(sbi, i); in fsck_chk_meta()
1818 else if (IS_CUR_SEGNO(sbi, i)) { in fsck_chk_meta()
1826 if (fsck->chk.sit_free_segs + sit_valid_segs != TOTAL_SEGS(sbi)) { in fsck_chk_meta()
1830 TOTAL_SEGS(sbi)); in fsck_chk_meta()
1862 if (fsck_chk_orphan_node(sbi)) in fsck_chk_meta()
1877 if (!IS_VALID_BLK_ADDR(sbi, blk)) { in fsck_chk_meta()
1884 if (!f2fs_test_sit_bitmap(sbi, blk)) { in fsck_chk_meta()
1891 if (!IS_VALID_NID(sbi, ino)) { in fsck_chk_meta()
1906 if (fsck_chk_quota_node(sbi)) in fsck_chk_meta()
1920 void fsck_init(struct f2fs_sb_info *sbi) in fsck_init() argument
1922 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_init()
1923 struct f2fs_sm_info *sm_i = SM_I(sbi); in fsck_init()
1934 fsck->nr_main_blks = sm_i->main_segments << sbi->log_blocks_per_seg; in fsck_init()
1939 build_nat_area_bitmap(sbi); in fsck_init()
1941 build_sit_area_bitmap(sbi); in fsck_init()
1948 static void fix_hard_links(struct f2fs_sb_info *sbi) in fix_hard_links() argument
1950 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fix_hard_links()
1965 if (sanity_check_nid(sbi, node->nid, node_blk, in fix_hard_links()
1983 static void fix_nat_entries(struct f2fs_sb_info *sbi) in fix_nat_entries() argument
1985 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fix_nat_entries()
1990 nullify_nat_entry(sbi, i); in fix_nat_entries()
1993 static void flush_curseg_sit_entries(struct f2fs_sb_info *sbi) in flush_curseg_sit_entries() argument
1995 struct sit_info *sit_i = SIT_I(sbi); in flush_curseg_sit_entries()
2005 struct curseg_info *curseg = CURSEG_I(sbi, i); in flush_curseg_sit_entries()
2009 se = get_seg_entry(sbi, curseg->segno); in flush_curseg_sit_entries()
2010 get_current_sit_page(sbi, curseg->segno, sit_blk); in flush_curseg_sit_entries()
2014 rewrite_current_sit_page(sbi, curseg->segno, sit_blk); in flush_curseg_sit_entries()
2020 static void fix_checkpoint(struct f2fs_sb_info *sbi) in fix_checkpoint() argument
2022 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fix_checkpoint()
2023 struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi); in fix_checkpoint()
2024 struct f2fs_checkpoint *cp = F2FS_CKPT(sbi); in fix_checkpoint()
2034 orphan_blks = __start_sum_addr(sbi) - 1; in fix_checkpoint()
2054 set_cp(free_segment_count, get_free_segments(sbi)); in fix_checkpoint()
2063 if (sbi->cur_cp == 2) in fix_checkpoint()
2078 struct curseg_info *curseg = CURSEG_I(sbi, i); in fix_checkpoint()
2092 write_nat_bits(sbi, sb, cp, sbi->cur_cp); in fix_checkpoint()
2095 int check_curseg_offset(struct f2fs_sb_info *sbi) in check_curseg_offset() argument
2100 struct curseg_info *curseg = CURSEG_I(sbi, i); in check_curseg_offset()
2106 se = get_seg_entry(sbi, curseg->segno); in check_curseg_offset()
2115 nblocks = sbi->blocks_per_seg; in check_curseg_offset()
2126 int check_sit_types(struct f2fs_sb_info *sbi) in check_sit_types() argument
2131 for (i = 0; i < TOTAL_SEGS(sbi); i++) { in check_sit_types()
2134 se = get_seg_entry(sbi, i); in check_sit_types()
2149 static struct f2fs_node *fsck_get_lpf(struct f2fs_sb_info *sbi) in fsck_get_lpf() argument
2159 get_node_info(sbi, F2FS_ROOT_INO(sbi), &ni); in fsck_get_lpf()
2164 lpf_ino = f2fs_lookup(sbi, node, (u8 *)LPF, strlen(LPF)); in fsck_get_lpf()
2166 get_node_info(sbi, lpf_ino, &ni); in fsck_get_lpf()
2184 de.pino = F2FS_ROOT_INO(sbi), in fsck_get_lpf()
2190 err = f2fs_mkdir(sbi, &de); in fsck_get_lpf()
2196 get_node_info(sbi, de.ino, &ni); in fsck_get_lpf()
2210 static int fsck_do_reconnect_file(struct f2fs_sb_info *sbi, in fsck_do_reconnect_file() argument
2225 if (f2fs_lookup(sbi, lpf, (u8 *)name, namelen)) { in fsck_do_reconnect_file()
2230 get_node_info(sbi, le32_to_cpu(lpf->footer.ino), &ni); in fsck_do_reconnect_file()
2232 ret = f2fs_add_link(sbi, lpf, (unsigned char *)name, namelen, in fsck_do_reconnect_file()
2243 get_node_info(sbi, le32_to_cpu(fnode->footer.ino), &ni); in fsck_do_reconnect_file()
2251 static void fsck_failed_reconnect_file_dnode(struct f2fs_sb_info *sbi, in fsck_failed_reconnect_file_dnode() argument
2254 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_failed_reconnect_file_dnode()
2263 get_node_info(sbi, nid, &ni); in fsck_failed_reconnect_file_dnode()
2269 f2fs_clear_main_bitmap(sbi, ni.blk_addr); in fsck_failed_reconnect_file_dnode()
2278 f2fs_clear_main_bitmap(sbi, addr); in fsck_failed_reconnect_file_dnode()
2284 static void fsck_failed_reconnect_file_idnode(struct f2fs_sb_info *sbi, in fsck_failed_reconnect_file_idnode() argument
2287 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_failed_reconnect_file_idnode()
2296 get_node_info(sbi, nid, &ni); in fsck_failed_reconnect_file_idnode()
2302 f2fs_clear_main_bitmap(sbi, ni.blk_addr); in fsck_failed_reconnect_file_idnode()
2308 fsck_failed_reconnect_file_dnode(sbi, tmp); in fsck_failed_reconnect_file_idnode()
2314 static void fsck_failed_reconnect_file_didnode(struct f2fs_sb_info *sbi, in fsck_failed_reconnect_file_didnode() argument
2317 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_failed_reconnect_file_didnode()
2326 get_node_info(sbi, nid, &ni); in fsck_failed_reconnect_file_didnode()
2332 f2fs_clear_main_bitmap(sbi, ni.blk_addr); in fsck_failed_reconnect_file_didnode()
2338 fsck_failed_reconnect_file_idnode(sbi, tmp); in fsck_failed_reconnect_file_didnode()
2349 static void fsck_failed_reconnect_file(struct f2fs_sb_info *sbi, nid_t ino) in fsck_failed_reconnect_file() argument
2351 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_failed_reconnect_file()
2360 get_node_info(sbi, ino, &ni); in fsck_failed_reconnect_file()
2368 f2fs_clear_main_bitmap(sbi, ni.blk_addr); in fsck_failed_reconnect_file()
2375 get_node_info(sbi, nid, &ni); in fsck_failed_reconnect_file()
2376 f2fs_clear_main_bitmap(sbi, ni.blk_addr); in fsck_failed_reconnect_file()
2389 f2fs_clear_main_bitmap(sbi, addr); in fsck_failed_reconnect_file()
2401 fsck_failed_reconnect_file_dnode(sbi, nid); in fsck_failed_reconnect_file()
2405 fsck_failed_reconnect_file_idnode(sbi, nid); in fsck_failed_reconnect_file()
2408 fsck_failed_reconnect_file_didnode(sbi, nid); in fsck_failed_reconnect_file()
2425 static int fsck_reconnect_file(struct f2fs_sb_info *sbi) in fsck_reconnect_file() argument
2427 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_reconnect_file()
2443 if (is_qf_ino(F2FS_RAW_SUPER(sbi), nid)) { in fsck_reconnect_file()
2449 get_node_info(sbi, nid, &ni); in fsck_reconnect_file()
2467 if (sanity_check_nid(sbi, nid, node, ftype, in fsck_reconnect_file()
2475 fsck_chk_inode_blk(sbi, nid, ftype, node, in fsck_reconnect_file()
2482 lpf_node = fsck_get_lpf(sbi); in fsck_reconnect_file()
2488 get_node_info(sbi, nid, &ni); in fsck_reconnect_file()
2492 if (fsck_do_reconnect_file(sbi, lpf_node, node)) { in fsck_reconnect_file()
2495 fsck_failed_reconnect_file(sbi, nid); in fsck_reconnect_file()
2513 int fsck_chk_curseg_info(struct f2fs_sb_info *sbi) in fsck_chk_curseg_info() argument
2521 curseg = CURSEG_I(sbi, i); in fsck_chk_curseg_info()
2522 se = get_seg_entry(sbi, curseg->segno); in fsck_chk_curseg_info()
2552 int fsck_verify(struct f2fs_sb_info *sbi) in fsck_verify() argument
2558 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_verify()
2568 i = fsck_reconnect_file(sbi); in fsck_verify()
2577 get_node_info(sbi, i, &ni); in fsck_verify()
2623 if (sbi->total_valid_block_count == fsck->chk.valid_blk_cnt) { in fsck_verify()
2632 if (sbi->total_valid_node_count == fsck->chk.valid_node_cnt) { in fsck_verify()
2641 if (sbi->total_valid_node_count == fsck->chk.valid_nat_entry_cnt) { in fsck_verify()
2650 if (sbi->total_valid_inode_count == fsck->chk.valid_inode_cnt) { in fsck_verify()
2659 if (le32_to_cpu(F2FS_CKPT(sbi)->free_segment_count) == in fsck_verify()
2669 if (check_curseg_offset(sbi) == 0) { in fsck_verify()
2678 if (check_sit_types(sbi) != 0) in fsck_verify()
2699 dump_node(sbi, i, 1); in fsck_verify()
2706 struct f2fs_checkpoint *cp = F2FS_CKPT(sbi); in fsck_verify()
2710 flush_journal_entries(sbi); in fsck_verify()
2711 fix_hard_links(sbi); in fsck_verify()
2712 fix_nat_entries(sbi); in fsck_verify()
2713 rewrite_sit_area_bitmap(sbi); in fsck_verify()
2714 if (check_curseg_offset(sbi)) { in fsck_verify()
2715 move_curseg_info(sbi, SM_I(sbi)->main_blkaddr, 0); in fsck_verify()
2716 write_curseg_info(sbi); in fsck_verify()
2717 flush_curseg_sit_entries(sbi); in fsck_verify()
2719 fix_checkpoint(sbi); in fsck_verify()
2722 write_checkpoint(sbi); in fsck_verify()
2728 void fsck_free(struct f2fs_sb_info *sbi) in fsck_free() argument
2730 struct f2fs_fsck *fsck = F2FS_FSCK(sbi); in fsck_free()