Lines Matching refs:dn

639 pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs)  in f2fs_get_next_page_offset()  argument
641 const long direct_index = ADDRS_PER_INODE(dn->inode); in f2fs_get_next_page_offset()
642 const long direct_blks = ADDRS_PER_BLOCK(dn->inode); in f2fs_get_next_page_offset()
643 const long indirect_blks = ADDRS_PER_BLOCK(dn->inode) * NIDS_PER_BLOCK; in f2fs_get_next_page_offset()
644 unsigned int skipped_unit = ADDRS_PER_BLOCK(dn->inode); in f2fs_get_next_page_offset()
645 int cur_level = dn->cur_level; in f2fs_get_next_page_offset()
646 int max_level = dn->max_level; in f2fs_get_next_page_offset()
649 if (!dn->max_level) in f2fs_get_next_page_offset()
655 switch (dn->max_level) { in f2fs_get_next_page_offset()
666 f2fs_bug_on(F2FS_I_SB(dn->inode), 1); in f2fs_get_next_page_offset()
755 int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode) in f2fs_get_dnode_of_data() argument
757 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_get_dnode_of_data()
766 level = get_node_path(dn->inode, index, offset, noffset); in f2fs_get_dnode_of_data()
770 nids[0] = dn->inode->i_ino; in f2fs_get_dnode_of_data()
771 npage[0] = dn->inode_page; in f2fs_get_dnode_of_data()
780 if (f2fs_has_inline_data(dn->inode) && index) { in f2fs_get_dnode_of_data()
789 dn->inode_page = npage[0]; in f2fs_get_dnode_of_data()
790 dn->inode_page_locked = true; in f2fs_get_dnode_of_data()
803 dn->nid = nids[i]; in f2fs_get_dnode_of_data()
804 npage[i] = f2fs_new_node_page(dn, noffset[i]); in f2fs_get_dnode_of_data()
823 dn->inode_page_locked = false; in f2fs_get_dnode_of_data()
842 dn->nid = nids[level]; in f2fs_get_dnode_of_data()
843 dn->ofs_in_node = offset[level]; in f2fs_get_dnode_of_data()
844 dn->node_page = npage[level]; in f2fs_get_dnode_of_data()
845 dn->data_blkaddr = f2fs_data_blkaddr(dn); in f2fs_get_dnode_of_data()
847 if (is_inode_flag_set(dn->inode, FI_COMPRESSED_FILE) && in f2fs_get_dnode_of_data()
849 unsigned int c_len = f2fs_cluster_blocks_are_contiguous(dn); in f2fs_get_dnode_of_data()
855 blkaddr = f2fs_data_blkaddr(dn); in f2fs_get_dnode_of_data()
857 blkaddr = data_blkaddr(dn->inode, dn->node_page, in f2fs_get_dnode_of_data()
858 dn->ofs_in_node + 1); in f2fs_get_dnode_of_data()
860 f2fs_update_extent_tree_range_compressed(dn->inode, in f2fs_get_dnode_of_data()
862 F2FS_I(dn->inode)->i_cluster_size, in f2fs_get_dnode_of_data()
873 dn->inode_page = NULL; in f2fs_get_dnode_of_data()
874 dn->node_page = NULL; in f2fs_get_dnode_of_data()
876 dn->cur_level = i; in f2fs_get_dnode_of_data()
877 dn->max_level = level; in f2fs_get_dnode_of_data()
878 dn->ofs_in_node = offset[level]; in f2fs_get_dnode_of_data()
883 static int truncate_node(struct dnode_of_data *dn) in truncate_node() argument
885 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in truncate_node()
890 err = f2fs_get_node_info(sbi, dn->nid, &ni); in truncate_node()
896 dec_valid_node_count(sbi, dn->inode, dn->nid == dn->inode->i_ino); in truncate_node()
899 if (dn->nid == dn->inode->i_ino) { in truncate_node()
900 f2fs_remove_orphan_inode(sbi, dn->nid); in truncate_node()
902 f2fs_inode_synced(dn->inode); in truncate_node()
905 clear_node_page_dirty(dn->node_page); in truncate_node()
908 index = dn->node_page->index; in truncate_node()
909 f2fs_put_page(dn->node_page, 1); in truncate_node()
914 dn->node_page = NULL; in truncate_node()
915 trace_f2fs_truncate_node(dn->inode, dn->nid, ni.blk_addr); in truncate_node()
920 static int truncate_dnode(struct dnode_of_data *dn) in truncate_dnode() argument
925 if (dn->nid == 0) in truncate_dnode()
929 page = f2fs_get_node_page(F2FS_I_SB(dn->inode), dn->nid); in truncate_dnode()
936 dn->node_page = page; in truncate_dnode()
937 dn->ofs_in_node = 0; in truncate_dnode()
938 f2fs_truncate_data_blocks(dn); in truncate_dnode()
939 err = truncate_node(dn); in truncate_dnode()
946 static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, in truncate_nodes() argument
949 struct dnode_of_data rdn = *dn; in truncate_nodes()
957 if (dn->nid == 0) in truncate_nodes()
960 trace_f2fs_truncate_nodes_enter(dn->inode, dn->nid, dn->data_blkaddr); in truncate_nodes()
962 page = f2fs_get_node_page(F2FS_I_SB(dn->inode), dn->nid); in truncate_nodes()
964 trace_f2fs_truncate_nodes_exit(dn->inode, PTR_ERR(page)); in truncate_nodes()
981 dn->node_changed = true; in truncate_nodes()
995 dn->node_changed = true; in truncate_nodes()
1006 dn->node_page = page; in truncate_nodes()
1007 ret = truncate_node(dn); in truncate_nodes()
1014 trace_f2fs_truncate_nodes_exit(dn->inode, freed); in truncate_nodes()
1019 trace_f2fs_truncate_nodes_exit(dn->inode, ret); in truncate_nodes()
1023 static int truncate_partial_nodes(struct dnode_of_data *dn, in truncate_partial_nodes() argument
1040 pages[i] = f2fs_get_node_page(F2FS_I_SB(dn->inode), nid[i]); in truncate_partial_nodes()
1056 dn->nid = child_nid; in truncate_partial_nodes()
1057 err = truncate_dnode(dn); in truncate_partial_nodes()
1061 dn->node_changed = true; in truncate_partial_nodes()
1065 dn->node_page = pages[idx]; in truncate_partial_nodes()
1066 dn->nid = nid[idx]; in truncate_partial_nodes()
1067 err = truncate_node(dn); in truncate_partial_nodes()
1080 trace_f2fs_truncate_partial_nodes(dn->inode, nid, depth, err); in truncate_partial_nodes()
1095 struct dnode_of_data dn; in f2fs_truncate_inode_blocks() local
1112 set_new_dnode(&dn, inode, page, NULL, 0); in f2fs_truncate_inode_blocks()
1125 err = truncate_partial_nodes(&dn, ri, offset, level); in f2fs_truncate_inode_blocks()
1134 err = truncate_partial_nodes(&dn, ri, offset, level); in f2fs_truncate_inode_blocks()
1144 dn.nid = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); in f2fs_truncate_inode_blocks()
1148 err = truncate_dnode(&dn); in f2fs_truncate_inode_blocks()
1153 err = truncate_nodes(&dn, nofs, offset[1], 2); in f2fs_truncate_inode_blocks()
1157 err = truncate_nodes(&dn, nofs, offset[1], 3); in f2fs_truncate_inode_blocks()
1190 struct dnode_of_data dn; in f2fs_truncate_xattr_node() local
1201 set_new_dnode(&dn, inode, NULL, npage, nid); in f2fs_truncate_xattr_node()
1202 err = truncate_node(&dn); in f2fs_truncate_xattr_node()
1219 struct dnode_of_data dn; in f2fs_remove_inode_page() local
1222 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); in f2fs_remove_inode_page()
1223 err = f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); in f2fs_remove_inode_page()
1229 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1236 f2fs_truncate_data_blocks_range(&dn, 1); in f2fs_remove_inode_page()
1240 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1252 err = truncate_node(&dn); in f2fs_remove_inode_page()
1254 f2fs_put_dnode(&dn); in f2fs_remove_inode_page()
1262 struct dnode_of_data dn; in f2fs_new_inode_page() local
1265 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); in f2fs_new_inode_page()
1268 return f2fs_new_node_page(&dn, 0); in f2fs_new_inode_page()
1271 struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) in f2fs_new_node_page() argument
1273 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_new_node_page()
1278 if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC))) in f2fs_new_node_page()
1281 page = f2fs_grab_cache_page(NODE_MAPPING(sbi), dn->nid, false); in f2fs_new_node_page()
1285 if (unlikely((err = inc_valid_node_count(sbi, dn->inode, !ofs)))) in f2fs_new_node_page()
1289 err = f2fs_get_node_info(sbi, dn->nid, &new_ni); in f2fs_new_node_page()
1291 dec_valid_node_count(sbi, dn->inode, !ofs); in f2fs_new_node_page()
1296 new_ni.nid = dn->nid; in f2fs_new_node_page()
1297 new_ni.ino = dn->inode->i_ino; in f2fs_new_node_page()
1304 fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true); in f2fs_new_node_page()
1305 set_cold_node(page, S_ISDIR(dn->inode->i_mode)); in f2fs_new_node_page()
1309 dn->node_changed = true; in f2fs_new_node_page()
1312 f2fs_i_xnid_write(dn->inode, dn->nid); in f2fs_new_node_page()
2695 struct dnode_of_data dn; in f2fs_recover_xattr_data() local
2717 set_new_dnode(&dn, inode, NULL, NULL, new_xnid); in f2fs_recover_xattr_data()
2718 xpage = f2fs_new_node_page(&dn, XATTR_NODE_OFFSET); in f2fs_recover_xattr_data()