Lines Matching full:dn
645 pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs) in f2fs_get_next_page_offset() argument
647 const long direct_index = ADDRS_PER_INODE(dn->inode); in f2fs_get_next_page_offset()
648 const long direct_blks = ADDRS_PER_BLOCK(dn->inode); in f2fs_get_next_page_offset()
649 const long indirect_blks = ADDRS_PER_BLOCK(dn->inode) * NIDS_PER_BLOCK; in f2fs_get_next_page_offset()
650 unsigned int skipped_unit = ADDRS_PER_BLOCK(dn->inode); in f2fs_get_next_page_offset()
651 int cur_level = dn->cur_level; in f2fs_get_next_page_offset()
652 int max_level = dn->max_level; in f2fs_get_next_page_offset()
655 if (!dn->max_level) in f2fs_get_next_page_offset()
661 switch (dn->max_level) { in f2fs_get_next_page_offset()
672 f2fs_bug_on(F2FS_I_SB(dn->inode), 1); in f2fs_get_next_page_offset()
757 * Caller should call f2fs_put_dnode(dn).
761 int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode) in f2fs_get_dnode_of_data() argument
763 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_get_dnode_of_data()
772 level = get_node_path(dn->inode, index, offset, noffset); in f2fs_get_dnode_of_data()
776 nids[0] = dn->inode->i_ino; in f2fs_get_dnode_of_data()
777 npage[0] = dn->inode_page; in f2fs_get_dnode_of_data()
786 if (f2fs_has_inline_data(dn->inode) && index) { in f2fs_get_dnode_of_data()
795 dn->inode_page = npage[0]; in f2fs_get_dnode_of_data()
796 dn->inode_page_locked = true; in f2fs_get_dnode_of_data()
809 dn->nid = nids[i]; in f2fs_get_dnode_of_data()
810 npage[i] = f2fs_new_node_page(dn, noffset[i]); in f2fs_get_dnode_of_data()
829 dn->inode_page_locked = false; in f2fs_get_dnode_of_data()
848 dn->nid = nids[level]; in f2fs_get_dnode_of_data()
849 dn->ofs_in_node = offset[level]; in f2fs_get_dnode_of_data()
850 dn->node_page = npage[level]; in f2fs_get_dnode_of_data()
851 dn->data_blkaddr = f2fs_data_blkaddr(dn); in f2fs_get_dnode_of_data()
853 if (is_inode_flag_set(dn->inode, FI_COMPRESSED_FILE) && in f2fs_get_dnode_of_data()
855 unsigned int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in f2fs_get_dnode_of_data()
856 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_get_dnode_of_data()
867 c_len = f2fs_cluster_blocks_are_contiguous(dn, ofs_in_node); in f2fs_get_dnode_of_data()
871 blkaddr = data_blkaddr(dn->inode, dn->node_page, ofs_in_node); in f2fs_get_dnode_of_data()
873 blkaddr = data_blkaddr(dn->inode, dn->node_page, in f2fs_get_dnode_of_data()
876 f2fs_update_read_extent_tree_range_compressed(dn->inode, in f2fs_get_dnode_of_data()
887 dn->inode_page = NULL; in f2fs_get_dnode_of_data()
888 dn->node_page = NULL; in f2fs_get_dnode_of_data()
890 dn->cur_level = i; in f2fs_get_dnode_of_data()
891 dn->max_level = level; in f2fs_get_dnode_of_data()
892 dn->ofs_in_node = offset[level]; in f2fs_get_dnode_of_data()
897 static int truncate_node(struct dnode_of_data *dn) in truncate_node() argument
899 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in truncate_node()
904 err = f2fs_get_node_info(sbi, dn->nid, &ni, false); in truncate_node()
910 dec_valid_node_count(sbi, dn->inode, dn->nid == dn->inode->i_ino); in truncate_node()
913 if (dn->nid == dn->inode->i_ino) { in truncate_node()
914 f2fs_remove_orphan_inode(sbi, dn->nid); in truncate_node()
916 f2fs_inode_synced(dn->inode); in truncate_node()
919 clear_node_page_dirty(dn->node_page); in truncate_node()
922 index = page_folio(dn->node_page)->index; in truncate_node()
923 f2fs_put_page(dn->node_page, 1); in truncate_node()
928 dn->node_page = NULL; in truncate_node()
929 trace_f2fs_truncate_node(dn->inode, dn->nid, ni.blk_addr); in truncate_node()
934 static int truncate_dnode(struct dnode_of_data *dn) in truncate_dnode() argument
936 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in truncate_dnode()
940 if (dn->nid == 0) in truncate_dnode()
944 page = f2fs_get_node_page(sbi, dn->nid); in truncate_dnode()
950 if (IS_INODE(page) || ino_of_node(page) != dn->inode->i_ino) { in truncate_dnode()
952 dn->inode->i_ino, dn->nid, ino_of_node(page)); in truncate_dnode()
960 dn->node_page = page; in truncate_dnode()
961 dn->ofs_in_node = 0; in truncate_dnode()
962 f2fs_truncate_data_blocks_range(dn, ADDRS_PER_BLOCK(dn->inode)); in truncate_dnode()
963 err = truncate_node(dn); in truncate_dnode()
972 static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, in truncate_nodes() argument
975 struct dnode_of_data rdn = *dn; in truncate_nodes()
983 if (dn->nid == 0) in truncate_nodes()
986 trace_f2fs_truncate_nodes_enter(dn->inode, dn->nid, dn->data_blkaddr); in truncate_nodes()
988 page = f2fs_get_node_page(F2FS_I_SB(dn->inode), dn->nid); in truncate_nodes()
990 trace_f2fs_truncate_nodes_exit(dn->inode, PTR_ERR(page)); in truncate_nodes()
1007 dn->node_changed = true; in truncate_nodes()
1021 dn->node_changed = true; in truncate_nodes()
1032 dn->node_page = page; in truncate_nodes()
1033 ret = truncate_node(dn); in truncate_nodes()
1040 trace_f2fs_truncate_nodes_exit(dn->inode, freed); in truncate_nodes()
1045 trace_f2fs_truncate_nodes_exit(dn->inode, ret); in truncate_nodes()
1049 static int truncate_partial_nodes(struct dnode_of_data *dn, in truncate_partial_nodes() argument
1066 pages[i] = f2fs_get_node_page(F2FS_I_SB(dn->inode), nid[i]); in truncate_partial_nodes()
1082 dn->nid = child_nid; in truncate_partial_nodes()
1083 err = truncate_dnode(dn); in truncate_partial_nodes()
1087 dn->node_changed = true; in truncate_partial_nodes()
1091 dn->node_page = pages[idx]; in truncate_partial_nodes()
1092 dn->nid = nid[idx]; in truncate_partial_nodes()
1093 err = truncate_node(dn); in truncate_partial_nodes()
1106 trace_f2fs_truncate_partial_nodes(dn->inode, nid, depth, err); in truncate_partial_nodes()
1121 struct dnode_of_data dn; in f2fs_truncate_inode_blocks() local
1138 set_new_dnode(&dn, inode, page, NULL, 0); in f2fs_truncate_inode_blocks()
1151 err = truncate_partial_nodes(&dn, ri, offset, level); in f2fs_truncate_inode_blocks()
1160 err = truncate_partial_nodes(&dn, ri, offset, level); in f2fs_truncate_inode_blocks()
1170 dn.nid = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); in f2fs_truncate_inode_blocks()
1174 err = truncate_dnode(&dn); in f2fs_truncate_inode_blocks()
1179 err = truncate_nodes(&dn, nofs, offset[1], 2); in f2fs_truncate_inode_blocks()
1183 err = truncate_nodes(&dn, nofs, offset[1], 3); in f2fs_truncate_inode_blocks()
1196 inode->i_ino, dn.nid, offset[0], in f2fs_truncate_inode_blocks()
1226 struct dnode_of_data dn; in f2fs_truncate_xattr_node() local
1237 set_new_dnode(&dn, inode, NULL, npage, nid); in f2fs_truncate_xattr_node()
1238 err = truncate_node(&dn); in f2fs_truncate_xattr_node()
1255 struct dnode_of_data dn; in f2fs_remove_inode_page() local
1258 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); in f2fs_remove_inode_page()
1259 err = f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); in f2fs_remove_inode_page()
1265 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1272 f2fs_truncate_data_blocks_range(&dn, 1); in f2fs_remove_inode_page()
1276 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1288 err = truncate_node(&dn); in f2fs_remove_inode_page()
1290 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1298 struct dnode_of_data dn; in f2fs_new_inode_page() local
1301 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); in f2fs_new_inode_page()
1304 return f2fs_new_node_page(&dn, 0); in f2fs_new_inode_page()
1307 struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) in f2fs_new_node_page() argument
1309 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_new_node_page()
1314 if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC))) in f2fs_new_node_page()
1317 page = f2fs_grab_cache_page(NODE_MAPPING(sbi), dn->nid, false); in f2fs_new_node_page()
1321 if (unlikely((err = inc_valid_node_count(sbi, dn->inode, !ofs)))) in f2fs_new_node_page()
1325 err = f2fs_get_node_info(sbi, dn->nid, &new_ni, false); in f2fs_new_node_page()
1327 dec_valid_node_count(sbi, dn->inode, !ofs); in f2fs_new_node_page()
1332 dec_valid_node_count(sbi, dn->inode, !ofs); in f2fs_new_node_page()
1338 new_ni.nid = dn->nid; in f2fs_new_node_page()
1339 new_ni.ino = dn->inode->i_ino; in f2fs_new_node_page()
1346 fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true); in f2fs_new_node_page()
1347 set_cold_node(page, S_ISDIR(dn->inode->i_mode)); in f2fs_new_node_page()
1351 dn->node_changed = true; in f2fs_new_node_page()
1354 f2fs_i_xnid_write(dn->inode, dn->nid); in f2fs_new_node_page()
2741 struct dnode_of_data dn; in f2fs_recover_xattr_data() local
2763 set_new_dnode(&dn, inode, NULL, NULL, new_xnid); in f2fs_recover_xattr_data()
2764 xpage = f2fs_new_node_page(&dn, XATTR_NODE_OFFSET); in f2fs_recover_xattr_data()