• Home
  • Raw
  • Download

Lines Matching refs:node_blk

226 	struct f2fs_node *node_blk = NULL;  in is_valid_summary()  local
231 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in is_valid_summary()
232 ASSERT(node_blk != NULL); in is_valid_summary()
243 ret = dev_read_block(node_blk, ni.blk_addr); in is_valid_summary()
246 if (le32_to_cpu(node_blk->footer.nid) != nid) in is_valid_summary()
250 if (node_blk->footer.nid == node_blk->footer.ino) { in is_valid_summary()
251 int ofs = get_extra_isize(node_blk); in is_valid_summary()
255 target_blk_addr = node_blk->i.i_addr[ofs + ofs_in_node]; in is_valid_summary()
259 target_blk_addr = node_blk->dn.addr[ofs_in_node]; in is_valid_summary()
265 free(node_blk); in is_valid_summary()
390 struct f2fs_node *node_blk, in sanity_check_nid() argument
418 ret = dev_read_block(node_blk, ni->blk_addr); 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()
428 if (ni->ino != le32_to_cpu(node_blk->footer.ino)) { in sanity_check_nid()
430 nid, ni->ino, le32_to_cpu(node_blk->footer.ino)); in sanity_check_nid()
434 node_blk->footer.nid == node_blk->footer.ino) { in sanity_check_nid()
436 nid, le32_to_cpu(node_blk->footer.nid), in sanity_check_nid()
437 le32_to_cpu(node_blk->footer.ino)); in sanity_check_nid()
441 if (le32_to_cpu(node_blk->footer.nid) != nid) { in sanity_check_nid()
444 le32_to_cpu(node_blk->footer.nid)); in sanity_check_nid()
449 u32 flag = le32_to_cpu(node_blk->footer.flag); in sanity_check_nid()
473 __check_inode_mode(nid, ftype, le16_to_cpu(node_blk->i.i_mode))) in sanity_check_nid()
518 struct f2fs_node *node_blk, in fsck_sanity_check_nid() argument
522 return sanity_check_nid(sbi, nid, node_blk, ftype, ntype, ni); in fsck_sanity_check_nid()
528 struct f2fs_node *node_blk = NULL; in fsck_chk_xattr_blk() local
535 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in fsck_chk_xattr_blk()
536 ASSERT(node_blk != NULL); in fsck_chk_xattr_blk()
539 if (sanity_check_nid(sbi, x_nid, node_blk, in fsck_chk_xattr_blk()
549 free(node_blk); in fsck_chk_xattr_blk()
559 struct f2fs_node *node_blk = NULL; in fsck_chk_node_blk() local
561 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in fsck_chk_node_blk()
562 ASSERT(node_blk != NULL); in fsck_chk_node_blk()
564 if (sanity_check_nid(sbi, nid, node_blk, ftype, ntype, &ni)) in fsck_chk_node_blk()
570 fsck_chk_inode_blk(sbi, nid, ftype, node_blk, blk_cnt, cbc, in fsck_chk_node_blk()
572 quota_add_inode_usage(fsck->qctx, nid, &node_blk->i); in fsck_chk_node_blk()
578 fsck_chk_dnode_blk(sbi, inode, nid, ftype, node_blk, in fsck_chk_node_blk()
584 fsck_chk_idnode_blk(sbi, inode, ftype, node_blk, in fsck_chk_node_blk()
590 fsck_chk_didnode_blk(sbi, inode, ftype, node_blk, in fsck_chk_node_blk()
597 free(node_blk); in fsck_chk_node_blk()
600 free(node_blk); in fsck_chk_node_blk()
677 struct f2fs_node *node_blk) in fsck_reada_all_direct_node_blocks() argument
682 u32 nid = le32_to_cpu(node_blk->in.nid[i]); in fsck_reada_all_direct_node_blocks()
690 enum FILE_TYPE ftype, struct f2fs_node *node_blk, in fsck_chk_inode_blk() argument
697 u32 i_links = le32_to_cpu(node_blk->i.i_links); in fsck_chk_inode_blk()
698 u64 i_size = le64_to_cpu(node_blk->i.i_size); in fsck_chk_inode_blk()
699 u64 i_blocks = le64_to_cpu(node_blk->i.i_blocks); in fsck_chk_inode_blk()
701 u32 i_flags = le32_to_cpu(node_blk->i.i_flags); in fsck_chk_inode_blk()
703 bool compr_rel = node_blk->i.i_inline & F2FS_COMPRESS_RELEASED; in fsck_chk_inode_blk()
704 u64 i_compr_blocks = le64_to_cpu(node_blk->i.i_compr_blocks); in fsck_chk_inode_blk()
705 nid_t i_xattr_nid = le32_to_cpu(node_blk->i.i_xattr_nid); in fsck_chk_inode_blk()
713 u32 cluster_size = 1 << node_blk->i.i_log_cluster_size; in fsck_chk_inode_blk()
721 node_blk->i.i_flags &= ~cpu_to_le32(F2FS_COMPR_FL); in fsck_chk_inode_blk()
726 nid, i_flags, node_blk->i.i_flags); in fsck_chk_inode_blk()
733 child.pp_ino = le32_to_cpu(node_blk->i.i_pino); in fsck_chk_inode_blk()
734 child.dir_level = node_blk->i.i_dir_level; in fsck_chk_inode_blk()
741 memcpy(child.p_name, node_blk->i.i_name, in fsck_chk_inode_blk()
742 node_blk->i.i_namelen); in fsck_chk_inode_blk()
759 node_blk->i.i_links = in fsck_chk_inode_blk()
778 node_blk->i.i_xattr_nid = 0; in fsck_chk_inode_blk()
790 get_extent_info(&child.ei, &node_blk->i.i_ext); in fsck_chk_inode_blk()
793 if (f2fs_has_extra_isize(&node_blk->i)) { in fsck_chk_inode_blk()
796 le16_to_cpu(node_blk->i.i_extra_isize); in fsck_chk_inode_blk()
805 node_blk->i.i_extra_isize = in fsck_chk_inode_blk()
815 nid, node_blk->i.i_inline); in fsck_chk_inode_blk()
817 node_blk->i.i_inline &= ~F2FS_EXTRA_ATTR; in fsck_chk_inode_blk()
824 (node_blk->i.i_inline & F2FS_INLINE_XATTR)) { in fsck_chk_inode_blk()
826 le16_to_cpu(node_blk->i.i_inline_xattr_size); in fsck_chk_inode_blk()
837 node_blk->i.i_inline_xattr_size = in fsck_chk_inode_blk()
844 ofs = get_extra_isize(node_blk); in fsck_chk_inode_blk()
846 if ((node_blk->i.i_flags & cpu_to_le32(F2FS_CASEFOLD_FL)) && in fsck_chk_inode_blk()
852 node_blk->i.i_flags &= ~cpu_to_le32(F2FS_CASEFOLD_FL); in fsck_chk_inode_blk()
857 if ((node_blk->i.i_inline & F2FS_INLINE_DATA)) { in fsck_chk_inode_blk()
858 unsigned int inline_size = MAX_INLINE_DATA(node_blk); in fsck_chk_inode_blk()
861 block_t blkaddr = le32_to_cpu(node_blk->i.i_addr[ofs]); in fsck_chk_inode_blk()
869 node_blk->i.i_addr[ofs] = 0; in fsck_chk_inode_blk()
870 node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); in fsck_chk_inode_blk()
878 node_blk->i.i_size = cpu_to_le64(inline_size); in fsck_chk_inode_blk()
884 if (!(node_blk->i.i_inline & F2FS_DATA_EXIST)) { in fsck_chk_inode_blk()
885 char buf[MAX_INLINE_DATA(node_blk)]; in fsck_chk_inode_blk()
886 memset(buf, 0, MAX_INLINE_DATA(node_blk)); in fsck_chk_inode_blk()
888 if (memcmp(buf, inline_data_addr(node_blk), in fsck_chk_inode_blk()
889 MAX_INLINE_DATA(node_blk))) { in fsck_chk_inode_blk()
893 node_blk->i.i_inline |= F2FS_DATA_EXIST; in fsck_chk_inode_blk()
903 if ((node_blk->i.i_inline & F2FS_INLINE_DENTRY)) { in fsck_chk_inode_blk()
904 block_t blkaddr = le32_to_cpu(node_blk->i.i_addr[ofs]); in fsck_chk_inode_blk()
913 node_blk->i.i_addr[ofs] = 0; in fsck_chk_inode_blk()
914 node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); in fsck_chk_inode_blk()
919 ret = fsck_chk_inline_dentries(sbi, node_blk, &child); in fsck_chk_inode_blk()
931 qf_maxsize[cur_qtype] = (ADDRS_PER_INODE(&node_blk->i) + in fsck_chk_inode_blk()
932 2 * ADDRS_PER_BLOCK(&node_blk->i) + in fsck_chk_inode_blk()
933 2 * ADDRS_PER_BLOCK(&node_blk->i) * in fsck_chk_inode_blk()
935 (u64) ADDRS_PER_BLOCK(&node_blk->i) * in fsck_chk_inode_blk()
938 for (idx = 0; idx < ADDRS_PER_INODE(&node_blk->i); in fsck_chk_inode_blk()
940 block_t blkaddr = le32_to_cpu(node_blk->i.i_addr[ofs + idx]); in fsck_chk_inode_blk()
951 node_blk->i.i_addr[ofs + idx] = in fsck_chk_inode_blk()
971 IS_CASEFOLDED(&node_blk->i), in fsck_chk_inode_blk()
975 file_is_encrypt(&node_blk->i)); in fsck_chk_inode_blk()
981 node_blk->i.i_addr[ofs + idx] = 0; in fsck_chk_inode_blk()
989 u32 nid = le32_to_cpu(node_blk->i.i_nid[idx]); in fsck_chk_inode_blk()
995 nid_t i_nid = le32_to_cpu(node_blk->i.i_nid[idx]); in fsck_chk_inode_blk()
1009 ret = fsck_chk_node_blk(sbi, &node_blk->i, i_nid, in fsck_chk_inode_blk()
1015 node_blk->i.i_nid[idx] = 0; in fsck_chk_inode_blk()
1021 child.pgofs += ADDRS_PER_BLOCK(&node_blk->i); in fsck_chk_inode_blk()
1023 child.pgofs += ADDRS_PER_BLOCK(&node_blk->i) * in fsck_chk_inode_blk()
1026 child.pgofs += ADDRS_PER_BLOCK(&node_blk->i) * in fsck_chk_inode_blk()
1048 node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); in fsck_chk_inode_blk()
1057 node_blk->i.i_compr_blocks = cpu_to_le64(cbc->cnt); in fsck_chk_inode_blk()
1068 namelen = le32_to_cpu(node_blk->i.i_namelen); in fsck_chk_inode_blk()
1077 node_blk->i.i_namelen = cpu_to_le32(child_d->i_namelen); in fsck_chk_inode_blk()
1084 pretty_print_filename(node_blk->i.i_name, namelen, en, in fsck_chk_inode_blk()
1085 file_enc_name(&node_blk->i)); in fsck_chk_inode_blk()
1088 le32_to_cpu(node_blk->footer.ino), in fsck_chk_inode_blk()
1093 le32_to_cpu(node_blk->footer.ino), in fsck_chk_inode_blk()
1098 le32_to_cpu(node_blk->footer.ino), en, in fsck_chk_inode_blk()
1099 le32_to_cpu(node_blk->i.i_current_depth), in fsck_chk_inode_blk()
1106 node_blk->i.i_links = cpu_to_le32(child.links); in fsck_chk_inode_blk()
1113 !(node_blk->i.i_inline & F2FS_INLINE_DOTS)) { in fsck_chk_inode_blk()
1117 node_blk->i.i_inline |= F2FS_INLINE_DOTS; in fsck_chk_inode_blk()
1124 i_gc_failures = le16_to_cpu(node_blk->i.i_gc_failures); in fsck_chk_inode_blk()
1134 le32_to_cpu(node_blk->footer.ino), en, in fsck_chk_inode_blk()
1138 node_blk->i.i_gc_failures = cpu_to_le16(0); in fsck_chk_inode_blk()
1149 node_blk->i.i_size = cpu_to_le64(F2FS_BLKSIZE); in fsck_chk_inode_blk()
1159 node_blk->i.i_links = 0; in fsck_chk_inode_blk()
1168 node_blk->i.i_ext.len = 0; in fsck_chk_inode_blk()
1171 f2fs_has_extra_isize(&node_blk->i)) { in fsck_chk_inode_blk()
1174 provided = le32_to_cpu(node_blk->i.i_inode_checksum); in fsck_chk_inode_blk()
1175 calculated = f2fs_inode_chksum(node_blk); in fsck_chk_inode_blk()
1181 node_blk->i.i_inode_checksum = in fsck_chk_inode_blk()
1191 ret = dev_write_block(node_blk, ni->blk_addr); in fsck_chk_inode_blk()
1197 u32 nid, enum FILE_TYPE ftype, struct f2fs_node *node_blk, in fsck_chk_dnode_blk() argument
1211 block_t blkaddr = le32_to_cpu(node_blk->dn.addr[idx]); in fsck_chk_dnode_blk()
1221 node_blk->dn.addr[idx] = NULL_ADDR; in fsck_chk_dnode_blk()
1249 node_blk->dn.addr[idx] = NULL_ADDR; in fsck_chk_dnode_blk()
1255 ret = dev_write_block(node_blk, ni->blk_addr); in fsck_chk_dnode_blk()
1262 enum FILE_TYPE ftype, struct f2fs_node *node_blk, u32 *blk_cnt, in fsck_chk_idnode_blk() argument
1268 fsck_reada_all_direct_node_blocks(sbi, node_blk); in fsck_chk_idnode_blk()
1271 if (le32_to_cpu(node_blk->in.nid[i]) == 0x0) in fsck_chk_idnode_blk()
1274 le32_to_cpu(node_blk->in.nid[i]), in fsck_chk_idnode_blk()
1283 node_blk->in.nid[i] = 0; in fsck_chk_idnode_blk()
1288 child->pgofs += ADDRS_PER_BLOCK(&node_blk->i); in fsck_chk_idnode_blk()
1294 nid_t nid = le32_to_cpu(node_blk->footer.nid); in fsck_chk_idnode_blk()
1297 ret = dev_write_block(node_blk, ni.blk_addr); in fsck_chk_idnode_blk()
1305 enum FILE_TYPE ftype, struct f2fs_node *node_blk, u32 *blk_cnt, in fsck_chk_didnode_blk() argument
1311 fsck_reada_all_direct_node_blocks(sbi, node_blk); in fsck_chk_didnode_blk()
1314 if (le32_to_cpu(node_blk->in.nid[i]) == 0x0) in fsck_chk_didnode_blk()
1317 le32_to_cpu(node_blk->in.nid[i]), in fsck_chk_didnode_blk()
1325 node_blk->in.nid[i] = 0; in fsck_chk_didnode_blk()
1330 child->pgofs += ADDRS_PER_BLOCK(&node_blk->i) * in fsck_chk_didnode_blk()
1337 nid_t nid = le32_to_cpu(node_blk->footer.nid); in fsck_chk_didnode_blk()
1340 ret = dev_write_block(node_blk, ni.blk_addr); in fsck_chk_didnode_blk()
1753 struct f2fs_node *node_blk, struct child_info *child) in fsck_chk_inline_dentries() argument
1762 inline_dentry = inline_data_addr(node_blk); in fsck_chk_inline_dentries()
1765 make_dentry_ptr(&d, node_blk, inline_dentry, 2); in fsck_chk_inline_dentries()
1776 dentries = __chk_dentries(sbi, IS_CASEFOLDED(&node_blk->i), child, in fsck_chk_inline_dentries()
1778 file_is_encrypt(&node_blk->i));// pass through in fsck_chk_inline_dentries()
2220 struct f2fs_node *node_blk = NULL; in fix_hard_links() local
2227 node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); in fix_hard_links()
2228 ASSERT(node_blk != NULL); in fix_hard_links()
2233 if (sanity_check_nid(sbi, node->nid, node_blk, in fix_hard_links()
2237 node_blk->i.i_links = cpu_to_le32(node->actual_links); in fix_hard_links()
2242 ret = dev_write_block(node_blk, ni.blk_addr); in fix_hard_links()
2248 free(node_blk); in fix_hard_links()