Lines Matching refs:node_blk
222 struct f2fs_node *node_blk = NULL; in is_valid_summary() local
227 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in is_valid_summary()
228 ASSERT(node_blk != NULL); in is_valid_summary()
239 ret = dev_read_block(node_blk, ni.blk_addr); in is_valid_summary()
242 if (le32_to_cpu(node_blk->footer.nid) != nid) in is_valid_summary()
246 if (node_blk->footer.nid == node_blk->footer.ino) { in is_valid_summary()
247 int ofs = get_extra_isize(node_blk); in is_valid_summary()
249 target_blk_addr = node_blk->i.i_addr[ofs + ofs_in_node]; in is_valid_summary()
251 target_blk_addr = node_blk->dn.addr[ofs_in_node]; in is_valid_summary()
257 free(node_blk); in is_valid_summary()
378 struct f2fs_node *node_blk, in sanity_check_nid() argument
406 ret = dev_read_block(node_blk, ni->blk_addr); in sanity_check_nid()
410 node_blk->footer.nid != node_blk->footer.ino) { in sanity_check_nid()
412 nid, le32_to_cpu(node_blk->footer.nid), in sanity_check_nid()
413 le32_to_cpu(node_blk->footer.ino)); in sanity_check_nid()
416 if (ni->ino != le32_to_cpu(node_blk->footer.ino)) { in sanity_check_nid()
418 nid, ni->ino, le32_to_cpu(node_blk->footer.ino)); in sanity_check_nid()
422 node_blk->footer.nid == node_blk->footer.ino) { in sanity_check_nid()
424 nid, le32_to_cpu(node_blk->footer.nid), in sanity_check_nid()
425 le32_to_cpu(node_blk->footer.ino)); in sanity_check_nid()
429 if (le32_to_cpu(node_blk->footer.nid) != nid) { in sanity_check_nid()
432 le32_to_cpu(node_blk->footer.nid)); in sanity_check_nid()
437 u32 flag = le32_to_cpu(node_blk->footer.flag); in sanity_check_nid()
461 __check_inode_mode(nid, ftype, le16_to_cpu(node_blk->i.i_mode))) in sanity_check_nid()
493 struct f2fs_node *node_blk = NULL; in fsck_chk_xattr_blk() local
500 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in fsck_chk_xattr_blk()
501 ASSERT(node_blk != NULL); in fsck_chk_xattr_blk()
504 if (sanity_check_nid(sbi, x_nid, node_blk, in fsck_chk_xattr_blk()
514 free(node_blk); in fsck_chk_xattr_blk()
523 struct f2fs_node *node_blk = NULL; in fsck_chk_node_blk() local
525 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in fsck_chk_node_blk()
526 ASSERT(node_blk != NULL); in fsck_chk_node_blk()
528 if (sanity_check_nid(sbi, nid, node_blk, ftype, ntype, &ni)) in fsck_chk_node_blk()
534 fsck_chk_inode_blk(sbi, nid, ftype, node_blk, blk_cnt, &ni, child); in fsck_chk_node_blk()
535 quota_add_inode_usage(fsck->qctx, nid, &node_blk->i); in fsck_chk_node_blk()
541 fsck_chk_dnode_blk(sbi, inode, nid, ftype, node_blk, in fsck_chk_node_blk()
547 fsck_chk_idnode_blk(sbi, inode, ftype, node_blk, in fsck_chk_node_blk()
553 fsck_chk_didnode_blk(sbi, inode, ftype, node_blk, in fsck_chk_node_blk()
560 free(node_blk); in fsck_chk_node_blk()
563 free(node_blk); in fsck_chk_node_blk()
640 struct f2fs_node *node_blk) in fsck_reada_all_direct_node_blocks() argument
645 u32 nid = le32_to_cpu(node_blk->in.nid[i]); in fsck_reada_all_direct_node_blocks()
653 enum FILE_TYPE ftype, struct f2fs_node *node_blk, in fsck_chk_inode_blk() argument
659 u32 i_links = le32_to_cpu(node_blk->i.i_links); in fsck_chk_inode_blk()
660 u64 i_size = le64_to_cpu(node_blk->i.i_size); in fsck_chk_inode_blk()
661 u64 i_blocks = le64_to_cpu(node_blk->i.i_blocks); in fsck_chk_inode_blk()
673 child.pp_ino = le32_to_cpu(node_blk->i.i_pino); in fsck_chk_inode_blk()
674 child.dir_level = node_blk->i.i_dir_level; in fsck_chk_inode_blk()
697 node_blk->i.i_links = 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()
715 le32_to_cpu(node_blk->i.i_xattr_nid), blk_cnt) && in fsck_chk_inode_blk()
717 node_blk->i.i_xattr_nid = 0; in fsck_chk_inode_blk()
720 nid, le32_to_cpu(node_blk->i.i_xattr_nid)); in fsck_chk_inode_blk()
728 get_extent_info(&child.ei, &node_blk->i.i_ext); in fsck_chk_inode_blk()
731 if (f2fs_has_extra_isize(&node_blk->i)) { in fsck_chk_inode_blk()
733 if (node_blk->i.i_extra_isize > in fsck_chk_inode_blk()
738 le16_to_cpu(node_blk->i.i_extra_isize), in fsck_chk_inode_blk()
740 node_blk->i.i_extra_isize = in fsck_chk_inode_blk()
747 nid, node_blk->i.i_inline); in fsck_chk_inode_blk()
749 node_blk->i.i_inline &= ~F2FS_EXTRA_ATTR; in fsck_chk_inode_blk()
755 (node_blk->i.i_inline & F2FS_INLINE_XATTR)) { in fsck_chk_inode_blk()
757 le16_to_cpu(node_blk->i.i_inline_xattr_size); in fsck_chk_inode_blk()
765 node_blk->i.i_inline_xattr_size = in fsck_chk_inode_blk()
771 ofs = get_extra_isize(node_blk); in fsck_chk_inode_blk()
773 if ((node_blk->i.i_inline & F2FS_INLINE_DATA)) { in fsck_chk_inode_blk()
774 if (le32_to_cpu(node_blk->i.i_addr[ofs]) != 0) { in fsck_chk_inode_blk()
777 le32_to_cpu(node_blk->i.i_addr[ofs])); in fsck_chk_inode_blk()
778 node_blk->i.i_addr[ofs] = 0; in fsck_chk_inode_blk()
779 node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); in fsck_chk_inode_blk()
782 if (!(node_blk->i.i_inline & F2FS_DATA_EXIST)) { in fsck_chk_inode_blk()
783 char buf[MAX_INLINE_DATA(node_blk)]; in fsck_chk_inode_blk()
784 memset(buf, 0, MAX_INLINE_DATA(node_blk)); in fsck_chk_inode_blk()
786 if (memcmp(buf, inline_data_addr(node_blk), in fsck_chk_inode_blk()
787 MAX_INLINE_DATA(node_blk))) { in fsck_chk_inode_blk()
789 node_blk->i.i_inline |= F2FS_DATA_EXIST; in fsck_chk_inode_blk()
798 if ((node_blk->i.i_inline & F2FS_INLINE_DENTRY)) { in fsck_chk_inode_blk()
800 if (le32_to_cpu(node_blk->i.i_addr[ofs]) != 0) { in fsck_chk_inode_blk()
803 le32_to_cpu(node_blk->i.i_addr[ofs])); in fsck_chk_inode_blk()
804 node_blk->i.i_addr[ofs] = 0; in fsck_chk_inode_blk()
805 node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); in fsck_chk_inode_blk()
809 ret = fsck_chk_inline_dentries(sbi, node_blk, &child); in fsck_chk_inode_blk()
819 for (idx = 0; idx < ADDRS_PER_INODE(&node_blk->i); in fsck_chk_inode_blk()
821 block_t blkaddr = le32_to_cpu(node_blk->i.i_addr[ofs + idx]); in fsck_chk_inode_blk()
831 file_is_encrypt(&node_blk->i)); in fsck_chk_inode_blk()
835 node_blk->i.i_addr[ofs + idx] = 0; in fsck_chk_inode_blk()
845 u32 nid = le32_to_cpu(node_blk->i.i_nid[idx]); in fsck_chk_inode_blk()
851 nid_t i_nid = le32_to_cpu(node_blk->i.i_nid[idx]); in fsck_chk_inode_blk()
865 ret = fsck_chk_node_blk(sbi, &node_blk->i, i_nid, in fsck_chk_inode_blk()
871 node_blk->i.i_nid[idx] = 0; in fsck_chk_inode_blk()
903 node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); in fsck_chk_inode_blk()
913 namelen = le32_to_cpu(node_blk->i.i_namelen); in fsck_chk_inode_blk()
922 node_blk->i.i_namelen = cpu_to_le32(child_d->i_namelen); in fsck_chk_inode_blk()
929 namelen = convert_encrypted_name(node_blk->i.i_name, namelen, in fsck_chk_inode_blk()
930 en, file_enc_name(&node_blk->i)); in fsck_chk_inode_blk()
934 le32_to_cpu(node_blk->footer.ino), in fsck_chk_inode_blk()
939 le32_to_cpu(node_blk->footer.ino), in fsck_chk_inode_blk()
944 le32_to_cpu(node_blk->footer.ino), en, in fsck_chk_inode_blk()
945 le32_to_cpu(node_blk->i.i_current_depth), in fsck_chk_inode_blk()
952 node_blk->i.i_links = cpu_to_le32(child.links); in fsck_chk_inode_blk()
959 !(node_blk->i.i_inline & F2FS_INLINE_DOTS)) { in fsck_chk_inode_blk()
963 node_blk->i.i_inline |= F2FS_INLINE_DOTS; in fsck_chk_inode_blk()
970 i_gc_failures = le16_to_cpu(node_blk->i.i_gc_failures); in fsck_chk_inode_blk()
980 le32_to_cpu(node_blk->footer.ino), en, in fsck_chk_inode_blk()
984 node_blk->i.i_gc_failures = cpu_to_le16(0); in fsck_chk_inode_blk()
999 node_blk->i.i_size = cpu_to_le64(i_size); in fsck_chk_inode_blk()
1010 node_blk->i.i_links = 0; in fsck_chk_inode_blk()
1019 node_blk->i.i_ext.len = 0; in fsck_chk_inode_blk()
1022 f2fs_has_extra_isize(&node_blk->i)) { in fsck_chk_inode_blk()
1025 provided = le32_to_cpu(node_blk->i.i_inode_checksum); in fsck_chk_inode_blk()
1026 calculated = f2fs_inode_chksum(node_blk); in fsck_chk_inode_blk()
1032 node_blk->i.i_inode_checksum = in fsck_chk_inode_blk()
1042 ret = dev_write_block(node_blk, ni->blk_addr); in fsck_chk_inode_blk()
1048 u32 nid, enum FILE_TYPE ftype, struct f2fs_node *node_blk, in fsck_chk_dnode_blk() argument
1057 block_t blkaddr = le32_to_cpu(node_blk->dn.addr[idx]); in fsck_chk_dnode_blk()
1071 node_blk->dn.addr[idx] = 0; in fsck_chk_dnode_blk()
1077 ret = dev_write_block(node_blk, ni->blk_addr); in fsck_chk_dnode_blk()
1084 enum FILE_TYPE ftype, struct f2fs_node *node_blk, u32 *blk_cnt, in fsck_chk_idnode_blk() argument
1090 fsck_reada_all_direct_node_blocks(sbi, node_blk); in fsck_chk_idnode_blk()
1093 if (le32_to_cpu(node_blk->in.nid[i]) == 0x0) in fsck_chk_idnode_blk()
1096 le32_to_cpu(node_blk->in.nid[i]), in fsck_chk_idnode_blk()
1104 node_blk->in.nid[i] = 0; in fsck_chk_idnode_blk()
1115 nid_t nid = le32_to_cpu(node_blk->footer.nid); in fsck_chk_idnode_blk()
1118 ret = dev_write_block(node_blk, ni.blk_addr); in fsck_chk_idnode_blk()
1126 enum FILE_TYPE ftype, struct f2fs_node *node_blk, u32 *blk_cnt, in fsck_chk_didnode_blk() argument
1132 fsck_reada_all_direct_node_blocks(sbi, node_blk); in fsck_chk_didnode_blk()
1135 if (le32_to_cpu(node_blk->in.nid[i]) == 0x0) in fsck_chk_didnode_blk()
1138 le32_to_cpu(node_blk->in.nid[i]), in fsck_chk_didnode_blk()
1146 node_blk->in.nid[i] = 0; in fsck_chk_didnode_blk()
1157 nid_t nid = le32_to_cpu(node_blk->footer.nid); in fsck_chk_didnode_blk()
1160 ret = dev_write_block(node_blk, ni.blk_addr); in fsck_chk_didnode_blk()
1550 struct f2fs_node *node_blk, struct child_info *child) in fsck_chk_inline_dentries() argument
1557 inline_dentry = inline_data_addr(node_blk); in fsck_chk_inline_dentries()
1560 make_dentry_ptr(&d, node_blk, inline_dentry, 2); in fsck_chk_inline_dentries()
1565 file_is_encrypt(&node_blk->i)); in fsck_chk_inline_dentries()
1952 struct f2fs_node *node_blk = NULL; in fix_hard_links() local
1959 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in fix_hard_links()
1960 ASSERT(node_blk != NULL); in fix_hard_links()
1965 if (sanity_check_nid(sbi, node->nid, node_blk, in fix_hard_links()
1969 node_blk->i.i_links = cpu_to_le32(node->actual_links); in fix_hard_links()
1974 ret = dev_write_block(node_blk, ni.blk_addr); in fix_hard_links()
1980 free(node_blk); in fix_hard_links()