Lines Matching full:dn

59 	struct dnode_of_data dn;  in f2fs_vm_page_mkwrite()  local
117 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_vm_page_mkwrite()
120 err = f2fs_get_block_locked(&dn, folio->index); in f2fs_vm_page_mkwrite()
122 err = f2fs_get_dnode_of_data(&dn, folio->index, LOOKUP_NODE); in f2fs_vm_page_mkwrite()
123 f2fs_put_dnode(&dn); in f2fs_vm_page_mkwrite()
125 !__is_valid_data_blkaddr(dn.data_blkaddr)) in f2fs_vm_page_mkwrite()
137 f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); in f2fs_vm_page_mkwrite()
399 struct dnode_of_data *dn, pgoff_t index, int whence) in __found_offset() argument
401 block_t blkaddr = f2fs_data_blkaddr(dn); in __found_offset()
406 block_t first_blkaddr = data_blkaddr(dn->inode, dn->node_page, in __found_offset()
407 ALIGN_DOWN(dn->ofs_in_node, F2FS_I(inode)->i_cluster_size)); in __found_offset()
436 struct dnode_of_data dn; in f2fs_seek_block() local
462 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_seek_block()
463 err = f2fs_get_dnode_of_data(&dn, pgofs, LOOKUP_NODE); in f2fs_seek_block()
469 pgofs = f2fs_get_next_page_offset(&dn, pgofs); in f2fs_seek_block()
476 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_seek_block()
479 for (; dn.ofs_in_node < end_offset; in f2fs_seek_block()
480 dn.ofs_in_node++, pgofs++, in f2fs_seek_block()
484 blkaddr = f2fs_data_blkaddr(&dn); in f2fs_seek_block()
489 f2fs_put_dnode(&dn); in f2fs_seek_block()
493 if (__found_offset(file->f_mapping, &dn, in f2fs_seek_block()
495 f2fs_put_dnode(&dn); in f2fs_seek_block()
499 f2fs_put_dnode(&dn); in f2fs_seek_block()
615 void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count) in f2fs_truncate_data_blocks_range() argument
617 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_truncate_data_blocks_range()
618 int nr_free = 0, ofs = dn->ofs_in_node, len = count; in f2fs_truncate_data_blocks_range()
622 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in f2fs_truncate_data_blocks_range()
623 bool released = !atomic_read(&F2FS_I(dn->inode)->i_compr_blocks); in f2fs_truncate_data_blocks_range()
625 addr = get_dnode_addr(dn->inode, dn->node_page) + ofs; in f2fs_truncate_data_blocks_range()
628 for (; count > 0; count--, addr++, dn->ofs_in_node++, cluster_index++) { in f2fs_truncate_data_blocks_range()
631 if (f2fs_compressed_file(dn->inode) && in f2fs_truncate_data_blocks_range()
634 f2fs_i_compr_blocks_update(dn->inode, in f2fs_truncate_data_blocks_range()
643 f2fs_set_data_blkaddr(dn, NULL_ADDR); in f2fs_truncate_data_blocks_range()
662 f2fs_i_compr_blocks_update(dn->inode, valid_blocks, false); in f2fs_truncate_data_blocks_range()
670 fofs = f2fs_start_bidx_of_node(ofs_of_node(dn->node_page), in f2fs_truncate_data_blocks_range()
671 dn->inode) + ofs; in f2fs_truncate_data_blocks_range()
672 f2fs_update_read_extent_cache_range(dn, fofs, 0, len); in f2fs_truncate_data_blocks_range()
673 f2fs_update_age_extent_cache_range(dn, fofs, len); in f2fs_truncate_data_blocks_range()
674 dec_valid_block_count(sbi, dn->inode, nr_free); in f2fs_truncate_data_blocks_range()
676 dn->ofs_in_node = ofs; in f2fs_truncate_data_blocks_range()
679 trace_f2fs_truncate_data_blocks_range(dn->inode, dn->nid, in f2fs_truncate_data_blocks_range()
680 dn->ofs_in_node, nr_free); in f2fs_truncate_data_blocks_range()
720 struct dnode_of_data dn; in f2fs_do_truncate_blocks() local
749 set_new_dnode(&dn, inode, ipage, NULL, 0); in f2fs_do_truncate_blocks()
750 err = f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); in f2fs_do_truncate_blocks()
757 count = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_do_truncate_blocks()
759 count -= dn.ofs_in_node; in f2fs_do_truncate_blocks()
762 if (dn.ofs_in_node || IS_INODE(dn.node_page)) { in f2fs_do_truncate_blocks()
763 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_do_truncate_blocks()
767 f2fs_put_dnode(&dn); in f2fs_do_truncate_blocks()
1144 struct dnode_of_data dn; in f2fs_truncate_hole() local
1147 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_truncate_hole()
1148 err = f2fs_get_dnode_of_data(&dn, pg_start, LOOKUP_NODE); in f2fs_truncate_hole()
1151 pg_start = f2fs_get_next_page_offset(&dn, in f2fs_truncate_hole()
1158 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_truncate_hole()
1159 count = min(end_offset - dn.ofs_in_node, pg_end - pg_start); in f2fs_truncate_hole()
1163 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_truncate_hole()
1164 f2fs_put_dnode(&dn); in f2fs_truncate_hole()
1235 struct dnode_of_data dn; in __read_out_blkaddrs() local
1239 set_new_dnode(&dn, inode, NULL, NULL, 0); in __read_out_blkaddrs()
1240 ret = f2fs_get_dnode_of_data(&dn, off, LOOKUP_NODE_RA); in __read_out_blkaddrs()
1244 if (dn.max_level == 0) in __read_out_blkaddrs()
1247 dn.ofs_in_node, len); in __read_out_blkaddrs()
1253 done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, inode) - in __read_out_blkaddrs()
1254 dn.ofs_in_node, len); in __read_out_blkaddrs()
1255 for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) { in __read_out_blkaddrs()
1256 *blkaddr = f2fs_data_blkaddr(&dn); in __read_out_blkaddrs()
1261 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1268 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1273 f2fs_update_data_blkaddr(&dn, NULL_ADDR); in __read_out_blkaddrs()
1277 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1290 struct dnode_of_data dn; in __roll_back_blkaddrs() local
1297 set_new_dnode(&dn, inode, NULL, NULL, 0); in __roll_back_blkaddrs()
1298 ret = f2fs_get_dnode_of_data(&dn, off + i, LOOKUP_NODE_RA); in __roll_back_blkaddrs()
1303 f2fs_update_data_blkaddr(&dn, *blkaddr); in __roll_back_blkaddrs()
1305 f2fs_put_dnode(&dn); in __roll_back_blkaddrs()
1325 struct dnode_of_data dn; in __clone_blkaddrs() local
1330 set_new_dnode(&dn, dst_inode, NULL, NULL, 0); in __clone_blkaddrs()
1331 ret = f2fs_get_dnode_of_data(&dn, dst + i, ALLOC_NODE); in __clone_blkaddrs()
1335 ret = f2fs_get_node_info(sbi, dn.nid, &ni, false); in __clone_blkaddrs()
1337 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1342 ADDRS_PER_PAGE(dn.node_page, dst_inode) - in __clone_blkaddrs()
1343 dn.ofs_in_node, len - i); in __clone_blkaddrs()
1345 dn.data_blkaddr = f2fs_data_blkaddr(&dn); in __clone_blkaddrs()
1346 f2fs_truncate_data_blocks_range(&dn, 1); in __clone_blkaddrs()
1353 f2fs_replace_block(sbi, &dn, dn.data_blkaddr, in __clone_blkaddrs()
1358 dn.ofs_in_node++; in __clone_blkaddrs()
1365 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1513 static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start, in f2fs_do_zero_range() argument
1516 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_do_zero_range()
1518 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_do_zero_range()
1522 for (; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1523 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in f2fs_do_zero_range()
1527 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1528 ret = f2fs_reserve_new_blocks(dn, count); in f2fs_do_zero_range()
1532 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1533 for (index = start; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1534 dn->data_blkaddr = f2fs_data_blkaddr(dn); in f2fs_do_zero_range()
1539 if (dn->data_blkaddr == NULL_ADDR) { in f2fs_do_zero_range()
1544 if (dn->data_blkaddr == NEW_ADDR) in f2fs_do_zero_range()
1547 if (!f2fs_is_valid_blkaddr(sbi, dn->data_blkaddr, in f2fs_do_zero_range()
1553 f2fs_invalidate_blocks(sbi, dn->data_blkaddr); in f2fs_do_zero_range()
1554 f2fs_set_data_blkaddr(dn, NEW_ADDR); in f2fs_do_zero_range()
1557 f2fs_update_read_extent_cache_range(dn, start, 0, index - start); in f2fs_do_zero_range()
1558 f2fs_update_age_extent_cache_range(dn, start, index - start); in f2fs_do_zero_range()
1610 struct dnode_of_data dn; in f2fs_zero_range() local
1623 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_zero_range()
1624 ret = f2fs_get_dnode_of_data(&dn, index, ALLOC_NODE); in f2fs_zero_range()
1632 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_zero_range()
1633 end = min(pg_end, end_offset - dn.ofs_in_node + index); in f2fs_zero_range()
1635 ret = f2fs_do_zero_range(&dn, index, end); in f2fs_zero_range()
1636 f2fs_put_dnode(&dn); in f2fs_zero_range()
1642 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_zero_range()
3571 static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count) in release_compress_blocks() argument
3573 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in release_compress_blocks()
3575 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in release_compress_blocks()
3580 blkaddr = data_blkaddr(dn->inode, dn->node_page, in release_compress_blocks()
3581 dn->ofs_in_node + i); in release_compress_blocks()
3593 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in release_compress_blocks()
3594 blkaddr = f2fs_data_blkaddr(dn); in release_compress_blocks()
3599 dn->ofs_in_node += cluster_size; in release_compress_blocks()
3609 f2fs_set_data_blkaddr(dn, NULL_ADDR); in release_compress_blocks()
3612 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, false); in release_compress_blocks()
3613 dec_valid_block_count(sbi, dn->inode, in release_compress_blocks()
3680 struct dnode_of_data dn; in f2fs_release_compress_blocks() local
3685 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_release_compress_blocks()
3686 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_release_compress_blocks()
3690 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_release_compress_blocks()
3698 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_release_compress_blocks()
3699 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_release_compress_blocks()
3702 ret = release_compress_blocks(&dn, count); in f2fs_release_compress_blocks()
3704 f2fs_put_dnode(&dn); in f2fs_release_compress_blocks()
3740 static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, in reserve_compress_blocks() argument
3743 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in reserve_compress_blocks()
3744 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; 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()
3766 blkaddr = data_blkaddr(dn->inode, dn->node_page, in reserve_compress_blocks()
3767 dn->ofs_in_node + i); in reserve_compress_blocks()
3771 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3796 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3800 ret = inc_valid_block_count(sbi, dn->inode, in reserve_compress_blocks()
3805 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in reserve_compress_blocks()
3806 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in reserve_compress_blocks()
3807 f2fs_set_data_blkaddr(dn, NEW_ADDR); in reserve_compress_blocks()
3810 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, true); in reserve_compress_blocks()
3858 struct dnode_of_data dn; in f2fs_reserve_compress_blocks() local
3863 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_reserve_compress_blocks()
3864 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_reserve_compress_blocks()
3868 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_reserve_compress_blocks()
3876 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_reserve_compress_blocks()
3877 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_reserve_compress_blocks()
3880 ret = reserve_compress_blocks(&dn, count, &reserved_blocks); in f2fs_reserve_compress_blocks()
3882 f2fs_put_dnode(&dn); in f2fs_reserve_compress_blocks()
4026 struct dnode_of_data dn; in f2fs_sec_trim_file() local
4030 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_sec_trim_file()
4031 ret = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in f2fs_sec_trim_file()
4034 index = f2fs_get_next_page_offset(&dn, index); in f2fs_sec_trim_file()
4040 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_sec_trim_file()
4041 count = min(end_offset - dn.ofs_in_node, pg_end - index); in f2fs_sec_trim_file()
4042 for (i = 0; i < count; i++, index++, dn.ofs_in_node++) { in f2fs_sec_trim_file()
4044 block_t blkaddr = f2fs_data_blkaddr(&dn); in f2fs_sec_trim_file()
4052 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
4073 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
4089 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()