Lines Matching refs:dn

601 pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs)  in f2fs_get_next_page_offset()  argument
603 const long direct_index = ADDRS_PER_INODE(dn->inode); in f2fs_get_next_page_offset()
607 int cur_level = dn->cur_level; in f2fs_get_next_page_offset()
608 int max_level = dn->max_level; in f2fs_get_next_page_offset()
611 if (!dn->max_level) in f2fs_get_next_page_offset()
617 switch (dn->max_level) { in f2fs_get_next_page_offset()
626 f2fs_bug_on(F2FS_I_SB(dn->inode), 1); in f2fs_get_next_page_offset()
716 int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode) in f2fs_get_dnode_of_data() argument
718 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_get_dnode_of_data()
727 level = get_node_path(dn->inode, index, offset, noffset); in f2fs_get_dnode_of_data()
731 nids[0] = dn->inode->i_ino; in f2fs_get_dnode_of_data()
732 npage[0] = dn->inode_page; in f2fs_get_dnode_of_data()
741 if (f2fs_has_inline_data(dn->inode) && index) { in f2fs_get_dnode_of_data()
750 dn->inode_page = npage[0]; in f2fs_get_dnode_of_data()
751 dn->inode_page_locked = true; in f2fs_get_dnode_of_data()
764 dn->nid = nids[i]; in f2fs_get_dnode_of_data()
765 npage[i] = f2fs_new_node_page(dn, noffset[i]); in f2fs_get_dnode_of_data()
784 dn->inode_page_locked = false; in f2fs_get_dnode_of_data()
803 dn->nid = nids[level]; in f2fs_get_dnode_of_data()
804 dn->ofs_in_node = offset[level]; in f2fs_get_dnode_of_data()
805 dn->node_page = npage[level]; in f2fs_get_dnode_of_data()
806 dn->data_blkaddr = datablock_addr(dn->inode, in f2fs_get_dnode_of_data()
807 dn->node_page, dn->ofs_in_node); in f2fs_get_dnode_of_data()
815 dn->inode_page = NULL; in f2fs_get_dnode_of_data()
816 dn->node_page = NULL; in f2fs_get_dnode_of_data()
818 dn->cur_level = i; in f2fs_get_dnode_of_data()
819 dn->max_level = level; in f2fs_get_dnode_of_data()
820 dn->ofs_in_node = offset[level]; in f2fs_get_dnode_of_data()
825 static int truncate_node(struct dnode_of_data *dn) in truncate_node() argument
827 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in truncate_node()
832 err = f2fs_get_node_info(sbi, dn->nid, &ni); in truncate_node()
838 dec_valid_node_count(sbi, dn->inode, dn->nid == dn->inode->i_ino); in truncate_node()
841 if (dn->nid == dn->inode->i_ino) { in truncate_node()
842 f2fs_remove_orphan_inode(sbi, dn->nid); in truncate_node()
844 f2fs_inode_synced(dn->inode); in truncate_node()
847 clear_node_page_dirty(dn->node_page); in truncate_node()
850 index = dn->node_page->index; in truncate_node()
851 f2fs_put_page(dn->node_page, 1); in truncate_node()
856 dn->node_page = NULL; in truncate_node()
857 trace_f2fs_truncate_node(dn->inode, dn->nid, ni.blk_addr); in truncate_node()
862 static int truncate_dnode(struct dnode_of_data *dn) in truncate_dnode() argument
867 if (dn->nid == 0) in truncate_dnode()
871 page = f2fs_get_node_page(F2FS_I_SB(dn->inode), dn->nid); in truncate_dnode()
878 dn->node_page = page; in truncate_dnode()
879 dn->ofs_in_node = 0; in truncate_dnode()
880 f2fs_truncate_data_blocks(dn); in truncate_dnode()
881 err = truncate_node(dn); in truncate_dnode()
890 static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, in truncate_nodes() argument
893 struct dnode_of_data rdn = *dn; in truncate_nodes()
901 if (dn->nid == 0) in truncate_nodes()
904 trace_f2fs_truncate_nodes_enter(dn->inode, dn->nid, dn->data_blkaddr); in truncate_nodes()
906 page = f2fs_get_node_page(F2FS_I_SB(dn->inode), dn->nid); in truncate_nodes()
908 trace_f2fs_truncate_nodes_exit(dn->inode, PTR_ERR(page)); in truncate_nodes()
925 dn->node_changed = true; in truncate_nodes()
939 dn->node_changed = true; in truncate_nodes()
950 dn->node_page = page; in truncate_nodes()
951 ret = truncate_node(dn); in truncate_nodes()
958 trace_f2fs_truncate_nodes_exit(dn->inode, freed); in truncate_nodes()
963 trace_f2fs_truncate_nodes_exit(dn->inode, ret); in truncate_nodes()
967 static int truncate_partial_nodes(struct dnode_of_data *dn, in truncate_partial_nodes() argument
984 pages[i] = f2fs_get_node_page(F2FS_I_SB(dn->inode), nid[i]); in truncate_partial_nodes()
1000 dn->nid = child_nid; in truncate_partial_nodes()
1001 err = truncate_dnode(dn); in truncate_partial_nodes()
1005 dn->node_changed = true; in truncate_partial_nodes()
1009 dn->node_page = pages[idx]; in truncate_partial_nodes()
1010 dn->nid = nid[idx]; in truncate_partial_nodes()
1011 err = truncate_node(dn); in truncate_partial_nodes()
1024 trace_f2fs_truncate_partial_nodes(dn->inode, nid, depth, err); in truncate_partial_nodes()
1039 struct dnode_of_data dn; in f2fs_truncate_inode_blocks() local
1054 set_new_dnode(&dn, inode, page, NULL, 0); in f2fs_truncate_inode_blocks()
1067 err = truncate_partial_nodes(&dn, ri, offset, level); in f2fs_truncate_inode_blocks()
1076 err = truncate_partial_nodes(&dn, ri, offset, level); in f2fs_truncate_inode_blocks()
1086 dn.nid = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); in f2fs_truncate_inode_blocks()
1090 err = truncate_dnode(&dn); in f2fs_truncate_inode_blocks()
1095 err = truncate_nodes(&dn, nofs, offset[1], 2); in f2fs_truncate_inode_blocks()
1099 err = truncate_nodes(&dn, nofs, offset[1], 3); in f2fs_truncate_inode_blocks()
1132 struct dnode_of_data dn; in f2fs_truncate_xattr_node() local
1143 set_new_dnode(&dn, inode, NULL, npage, nid); in f2fs_truncate_xattr_node()
1144 err = truncate_node(&dn); in f2fs_truncate_xattr_node()
1161 struct dnode_of_data dn; in f2fs_remove_inode_page() local
1164 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); in f2fs_remove_inode_page()
1165 err = f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); in f2fs_remove_inode_page()
1171 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1178 f2fs_truncate_data_blocks_range(&dn, 1); in f2fs_remove_inode_page()
1182 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1195 err = truncate_node(&dn); in f2fs_remove_inode_page()
1197 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1205 struct dnode_of_data dn; in f2fs_new_inode_page() local
1208 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); in f2fs_new_inode_page()
1211 return f2fs_new_node_page(&dn, 0); in f2fs_new_inode_page()
1214 struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) in f2fs_new_node_page() argument
1216 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_new_node_page()
1221 if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC))) in f2fs_new_node_page()
1224 page = f2fs_grab_cache_page(NODE_MAPPING(sbi), dn->nid, false); in f2fs_new_node_page()
1228 if (unlikely((err = inc_valid_node_count(sbi, dn->inode, !ofs)))) in f2fs_new_node_page()
1232 err = f2fs_get_node_info(sbi, dn->nid, &new_ni); in f2fs_new_node_page()
1234 dec_valid_node_count(sbi, dn->inode, !ofs); in f2fs_new_node_page()
1243 new_ni.nid = dn->nid; in f2fs_new_node_page()
1244 new_ni.ino = dn->inode->i_ino; in f2fs_new_node_page()
1251 fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true); in f2fs_new_node_page()
1252 set_cold_node(page, S_ISDIR(dn->inode->i_mode)); in f2fs_new_node_page()
1256 dn->node_changed = true; in f2fs_new_node_page()
1259 f2fs_i_xnid_write(dn->inode, dn->nid); in f2fs_new_node_page()
2499 struct dnode_of_data dn; in f2fs_recover_xattr_data() local
2521 set_new_dnode(&dn, inode, NULL, NULL, new_xnid); in f2fs_recover_xattr_data()
2522 xpage = f2fs_new_node_page(&dn, XATTR_NODE_OFFSET); in f2fs_recover_xattr_data()