Lines Matching full:dn
59 struct dnode_of_data dn; in f2fs_vm_page_mkwrite() local
116 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_vm_page_mkwrite()
117 err = f2fs_get_block_locked(&dn, page->index); in f2fs_vm_page_mkwrite()
122 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_vm_page_mkwrite()
123 err = f2fs_get_dnode_of_data(&dn, page->index, LOOKUP_NODE); in f2fs_vm_page_mkwrite()
124 f2fs_put_dnode(&dn); in f2fs_vm_page_mkwrite()
135 f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); in f2fs_vm_page_mkwrite()
418 struct dnode_of_data dn; in f2fs_seek_block() local
444 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_seek_block()
445 err = f2fs_get_dnode_of_data(&dn, pgofs, LOOKUP_NODE); in f2fs_seek_block()
451 pgofs = f2fs_get_next_page_offset(&dn, pgofs); in f2fs_seek_block()
458 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_seek_block()
461 for (; dn.ofs_in_node < end_offset; in f2fs_seek_block()
462 dn.ofs_in_node++, pgofs++, in f2fs_seek_block()
466 blkaddr = f2fs_data_blkaddr(&dn); in f2fs_seek_block()
471 f2fs_put_dnode(&dn); in f2fs_seek_block()
477 f2fs_put_dnode(&dn); in f2fs_seek_block()
481 f2fs_put_dnode(&dn); in f2fs_seek_block()
600 void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count) in f2fs_truncate_data_blocks_range() argument
602 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_truncate_data_blocks_range()
603 int nr_free = 0, ofs = dn->ofs_in_node, len = count; in f2fs_truncate_data_blocks_range()
607 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in f2fs_truncate_data_blocks_range()
608 bool released = !atomic_read(&F2FS_I(dn->inode)->i_compr_blocks); in f2fs_truncate_data_blocks_range()
610 addr = get_dnode_addr(dn->inode, dn->node_page) + ofs; in f2fs_truncate_data_blocks_range()
613 for (; count > 0; count--, addr++, dn->ofs_in_node++, cluster_index++) { in f2fs_truncate_data_blocks_range()
616 if (f2fs_compressed_file(dn->inode) && in f2fs_truncate_data_blocks_range()
619 f2fs_i_compr_blocks_update(dn->inode, in f2fs_truncate_data_blocks_range()
628 f2fs_set_data_blkaddr(dn, NULL_ADDR); in f2fs_truncate_data_blocks_range()
645 f2fs_i_compr_blocks_update(dn->inode, valid_blocks, false); in f2fs_truncate_data_blocks_range()
653 fofs = f2fs_start_bidx_of_node(ofs_of_node(dn->node_page), in f2fs_truncate_data_blocks_range()
654 dn->inode) + ofs; in f2fs_truncate_data_blocks_range()
655 f2fs_update_read_extent_cache_range(dn, fofs, 0, len); in f2fs_truncate_data_blocks_range()
656 f2fs_update_age_extent_cache_range(dn, fofs, len); in f2fs_truncate_data_blocks_range()
657 dec_valid_block_count(sbi, dn->inode, nr_free); in f2fs_truncate_data_blocks_range()
659 dn->ofs_in_node = ofs; in f2fs_truncate_data_blocks_range()
662 trace_f2fs_truncate_data_blocks_range(dn->inode, dn->nid, in f2fs_truncate_data_blocks_range()
663 dn->ofs_in_node, nr_free); in f2fs_truncate_data_blocks_range()
703 struct dnode_of_data dn; in f2fs_do_truncate_blocks() local
732 set_new_dnode(&dn, inode, ipage, NULL, 0); in f2fs_do_truncate_blocks()
733 err = f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); in f2fs_do_truncate_blocks()
740 count = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_do_truncate_blocks()
742 count -= dn.ofs_in_node; in f2fs_do_truncate_blocks()
745 if (dn.ofs_in_node || IS_INODE(dn.node_page)) { in f2fs_do_truncate_blocks()
746 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_do_truncate_blocks()
750 f2fs_put_dnode(&dn); in f2fs_do_truncate_blocks()
1131 struct dnode_of_data dn; in f2fs_truncate_hole() local
1134 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_truncate_hole()
1135 err = f2fs_get_dnode_of_data(&dn, pg_start, LOOKUP_NODE); in f2fs_truncate_hole()
1138 pg_start = f2fs_get_next_page_offset(&dn, in f2fs_truncate_hole()
1145 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_truncate_hole()
1146 count = min(end_offset - dn.ofs_in_node, pg_end - pg_start); in f2fs_truncate_hole()
1150 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_truncate_hole()
1151 f2fs_put_dnode(&dn); in f2fs_truncate_hole()
1222 struct dnode_of_data dn; in __read_out_blkaddrs() local
1226 set_new_dnode(&dn, inode, NULL, NULL, 0); in __read_out_blkaddrs()
1227 ret = f2fs_get_dnode_of_data(&dn, off, LOOKUP_NODE_RA); in __read_out_blkaddrs()
1231 if (dn.max_level == 0) in __read_out_blkaddrs()
1234 dn.ofs_in_node, len); in __read_out_blkaddrs()
1240 done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, inode) - in __read_out_blkaddrs()
1241 dn.ofs_in_node, len); in __read_out_blkaddrs()
1242 for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) { in __read_out_blkaddrs()
1243 *blkaddr = f2fs_data_blkaddr(&dn); in __read_out_blkaddrs()
1248 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1256 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1261 f2fs_update_data_blkaddr(&dn, NULL_ADDR); in __read_out_blkaddrs()
1265 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1278 struct dnode_of_data dn; in __roll_back_blkaddrs() local
1285 set_new_dnode(&dn, inode, NULL, NULL, 0); in __roll_back_blkaddrs()
1286 ret = f2fs_get_dnode_of_data(&dn, off + i, LOOKUP_NODE_RA); in __roll_back_blkaddrs()
1291 f2fs_update_data_blkaddr(&dn, *blkaddr); in __roll_back_blkaddrs()
1293 f2fs_put_dnode(&dn); in __roll_back_blkaddrs()
1313 struct dnode_of_data dn; in __clone_blkaddrs() local
1318 set_new_dnode(&dn, dst_inode, NULL, NULL, 0); in __clone_blkaddrs()
1319 ret = f2fs_get_dnode_of_data(&dn, dst + i, ALLOC_NODE); in __clone_blkaddrs()
1323 ret = f2fs_get_node_info(sbi, dn.nid, &ni, false); in __clone_blkaddrs()
1325 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1330 ADDRS_PER_PAGE(dn.node_page, dst_inode) - in __clone_blkaddrs()
1331 dn.ofs_in_node, len - i); in __clone_blkaddrs()
1333 dn.data_blkaddr = f2fs_data_blkaddr(&dn); in __clone_blkaddrs()
1334 f2fs_truncate_data_blocks_range(&dn, 1); in __clone_blkaddrs()
1341 f2fs_replace_block(sbi, &dn, dn.data_blkaddr, in __clone_blkaddrs()
1346 dn.ofs_in_node++; in __clone_blkaddrs()
1353 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1501 static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start, in f2fs_do_zero_range() argument
1504 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_do_zero_range()
1506 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_do_zero_range()
1510 for (; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1511 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in f2fs_do_zero_range()
1515 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1516 ret = f2fs_reserve_new_blocks(dn, count); in f2fs_do_zero_range()
1520 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1521 for (index = start; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1522 dn->data_blkaddr = f2fs_data_blkaddr(dn); in f2fs_do_zero_range()
1527 if (dn->data_blkaddr == NULL_ADDR) { in f2fs_do_zero_range()
1532 if (dn->data_blkaddr == NEW_ADDR) in f2fs_do_zero_range()
1535 if (!f2fs_is_valid_blkaddr(sbi, dn->data_blkaddr, in f2fs_do_zero_range()
1542 f2fs_invalidate_blocks(sbi, dn->data_blkaddr); in f2fs_do_zero_range()
1543 f2fs_set_data_blkaddr(dn, NEW_ADDR); in f2fs_do_zero_range()
1546 f2fs_update_read_extent_cache_range(dn, start, 0, index - start); in f2fs_do_zero_range()
1547 f2fs_update_age_extent_cache_range(dn, start, index - start); in f2fs_do_zero_range()
1599 struct dnode_of_data dn; in f2fs_zero_range() local
1612 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_zero_range()
1613 ret = f2fs_get_dnode_of_data(&dn, index, ALLOC_NODE); in f2fs_zero_range()
1621 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_zero_range()
1622 end = min(pg_end, end_offset - dn.ofs_in_node + index); in f2fs_zero_range()
1624 ret = f2fs_do_zero_range(&dn, index, end); in f2fs_zero_range()
1625 f2fs_put_dnode(&dn); in f2fs_zero_range()
1631 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_zero_range()
3553 static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count) in release_compress_blocks() argument
3555 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in release_compress_blocks()
3557 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in release_compress_blocks()
3562 blkaddr = data_blkaddr(dn->inode, dn->node_page, in release_compress_blocks()
3563 dn->ofs_in_node + i); in release_compress_blocks()
3577 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in release_compress_blocks()
3578 blkaddr = f2fs_data_blkaddr(dn); in release_compress_blocks()
3583 dn->ofs_in_node += cluster_size; in release_compress_blocks()
3593 f2fs_set_data_blkaddr(dn, NULL_ADDR); in release_compress_blocks()
3596 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, false); in release_compress_blocks()
3597 dec_valid_block_count(sbi, dn->inode, in release_compress_blocks()
3663 struct dnode_of_data dn; in f2fs_release_compress_blocks() local
3668 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_release_compress_blocks()
3669 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_release_compress_blocks()
3673 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_release_compress_blocks()
3681 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_release_compress_blocks()
3682 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_release_compress_blocks()
3685 ret = release_compress_blocks(&dn, count); in f2fs_release_compress_blocks()
3687 f2fs_put_dnode(&dn); in f2fs_release_compress_blocks()
3721 static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, in reserve_compress_blocks() argument
3724 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in reserve_compress_blocks()
3725 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in reserve_compress_blocks()
3730 blkaddr = data_blkaddr(dn->inode, dn->node_page, in reserve_compress_blocks()
3731 dn->ofs_in_node + i); in reserve_compress_blocks()
3749 blkaddr = data_blkaddr(dn->inode, dn->node_page, in reserve_compress_blocks()
3750 dn->ofs_in_node + i); in reserve_compress_blocks()
3754 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3779 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3783 ret = inc_valid_block_count(sbi, dn->inode, in reserve_compress_blocks()
3788 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in reserve_compress_blocks()
3789 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in reserve_compress_blocks()
3790 f2fs_set_data_blkaddr(dn, NEW_ADDR); in reserve_compress_blocks()
3793 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, true); in reserve_compress_blocks()
3840 struct dnode_of_data dn; in f2fs_reserve_compress_blocks() local
3845 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_reserve_compress_blocks()
3846 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_reserve_compress_blocks()
3850 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_reserve_compress_blocks()
3858 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_reserve_compress_blocks()
3859 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_reserve_compress_blocks()
3862 ret = reserve_compress_blocks(&dn, count, &reserved_blocks); in f2fs_reserve_compress_blocks()
3864 f2fs_put_dnode(&dn); in f2fs_reserve_compress_blocks()
4004 struct dnode_of_data dn; in f2fs_sec_trim_file() local
4008 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_sec_trim_file()
4009 ret = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in f2fs_sec_trim_file()
4012 index = f2fs_get_next_page_offset(&dn, index); in f2fs_sec_trim_file()
4018 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_sec_trim_file()
4019 count = min(end_offset - dn.ofs_in_node, pg_end - index); in f2fs_sec_trim_file()
4020 for (i = 0; i < count; i++, index++, dn.ofs_in_node++) { in f2fs_sec_trim_file()
4022 block_t blkaddr = f2fs_data_blkaddr(&dn); in f2fs_sec_trim_file()
4030 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
4053 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
4069 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()