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
769 set_new_dnode(&dn, inode, ipage, NULL, 0); in f2fs_do_truncate_blocks()
770 err = f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); in f2fs_do_truncate_blocks()
777 count = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_do_truncate_blocks()
779 count -= dn.ofs_in_node; in f2fs_do_truncate_blocks()
782 if (dn.ofs_in_node || IS_INODE(dn.node_page)) { in f2fs_do_truncate_blocks()
783 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_do_truncate_blocks()
787 f2fs_put_dnode(&dn); in f2fs_do_truncate_blocks()
1169 struct dnode_of_data dn; in f2fs_truncate_hole() local
1172 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_truncate_hole()
1173 err = f2fs_get_dnode_of_data(&dn, pg_start, LOOKUP_NODE); in f2fs_truncate_hole()
1176 pg_start = f2fs_get_next_page_offset(&dn, in f2fs_truncate_hole()
1183 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_truncate_hole()
1184 count = min(end_offset - dn.ofs_in_node, pg_end - pg_start); in f2fs_truncate_hole()
1188 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_truncate_hole()
1189 f2fs_put_dnode(&dn); in f2fs_truncate_hole()
1260 struct dnode_of_data dn; in __read_out_blkaddrs() local
1264 set_new_dnode(&dn, inode, NULL, NULL, 0); in __read_out_blkaddrs()
1265 ret = f2fs_get_dnode_of_data(&dn, off, LOOKUP_NODE_RA); in __read_out_blkaddrs()
1269 if (dn.max_level == 0) in __read_out_blkaddrs()
1272 dn.ofs_in_node, len); in __read_out_blkaddrs()
1278 done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, inode) - in __read_out_blkaddrs()
1279 dn.ofs_in_node, len); in __read_out_blkaddrs()
1280 for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) { in __read_out_blkaddrs()
1281 *blkaddr = f2fs_data_blkaddr(&dn); in __read_out_blkaddrs()
1286 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1293 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1298 f2fs_update_data_blkaddr(&dn, NULL_ADDR); in __read_out_blkaddrs()
1302 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1315 struct dnode_of_data dn; in __roll_back_blkaddrs() local
1322 set_new_dnode(&dn, inode, NULL, NULL, 0); in __roll_back_blkaddrs()
1323 ret = f2fs_get_dnode_of_data(&dn, off + i, LOOKUP_NODE_RA); in __roll_back_blkaddrs()
1328 f2fs_update_data_blkaddr(&dn, *blkaddr); in __roll_back_blkaddrs()
1330 f2fs_put_dnode(&dn); in __roll_back_blkaddrs()
1350 struct dnode_of_data dn; in __clone_blkaddrs() local
1355 set_new_dnode(&dn, dst_inode, NULL, NULL, 0); in __clone_blkaddrs()
1356 ret = f2fs_get_dnode_of_data(&dn, dst + i, ALLOC_NODE); in __clone_blkaddrs()
1360 ret = f2fs_get_node_info(sbi, dn.nid, &ni, false); in __clone_blkaddrs()
1362 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1367 ADDRS_PER_PAGE(dn.node_page, dst_inode) - in __clone_blkaddrs()
1368 dn.ofs_in_node, len - i); in __clone_blkaddrs()
1370 dn.data_blkaddr = f2fs_data_blkaddr(&dn); in __clone_blkaddrs()
1371 f2fs_truncate_data_blocks_range(&dn, 1); in __clone_blkaddrs()
1378 f2fs_replace_block(sbi, &dn, dn.data_blkaddr, in __clone_blkaddrs()
1383 dn.ofs_in_node++; in __clone_blkaddrs()
1390 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1538 static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start, in f2fs_do_zero_range() argument
1541 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_do_zero_range()
1543 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_do_zero_range()
1547 for (; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1548 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in f2fs_do_zero_range()
1552 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1553 ret = f2fs_reserve_new_blocks(dn, count); in f2fs_do_zero_range()
1557 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1558 for (index = start; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1559 dn->data_blkaddr = f2fs_data_blkaddr(dn); in f2fs_do_zero_range()
1564 if (dn->data_blkaddr == NULL_ADDR) { in f2fs_do_zero_range()
1569 if (dn->data_blkaddr == NEW_ADDR) in f2fs_do_zero_range()
1572 if (!f2fs_is_valid_blkaddr(sbi, dn->data_blkaddr, in f2fs_do_zero_range()
1578 f2fs_invalidate_blocks(sbi, dn->data_blkaddr); in f2fs_do_zero_range()
1579 f2fs_set_data_blkaddr(dn, NEW_ADDR); in f2fs_do_zero_range()
1582 f2fs_update_read_extent_cache_range(dn, start, 0, index - start); in f2fs_do_zero_range()
1583 f2fs_update_age_extent_cache_range(dn, start, index - start); in f2fs_do_zero_range()
1635 struct dnode_of_data dn; in f2fs_zero_range() local
1648 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_zero_range()
1649 ret = f2fs_get_dnode_of_data(&dn, index, ALLOC_NODE); in f2fs_zero_range()
1657 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_zero_range()
1658 end = min(pg_end, end_offset - dn.ofs_in_node + index); in f2fs_zero_range()
1660 ret = f2fs_do_zero_range(&dn, index, end); in f2fs_zero_range()
1661 f2fs_put_dnode(&dn); in f2fs_zero_range()
1667 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_zero_range()
3607 static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count) in release_compress_blocks() argument
3609 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in release_compress_blocks()
3611 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in release_compress_blocks()
3616 blkaddr = data_blkaddr(dn->inode, dn->node_page, in release_compress_blocks()
3617 dn->ofs_in_node + i); in release_compress_blocks()
3629 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in release_compress_blocks()
3630 blkaddr = f2fs_data_blkaddr(dn); in release_compress_blocks()
3635 dn->ofs_in_node += cluster_size; in release_compress_blocks()
3645 f2fs_set_data_blkaddr(dn, NULL_ADDR); in release_compress_blocks()
3648 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, false); in release_compress_blocks()
3649 dec_valid_block_count(sbi, dn->inode, in release_compress_blocks()
3716 struct dnode_of_data dn; in f2fs_release_compress_blocks() local
3721 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_release_compress_blocks()
3722 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_release_compress_blocks()
3726 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_release_compress_blocks()
3734 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_release_compress_blocks()
3735 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_release_compress_blocks()
3738 ret = release_compress_blocks(&dn, count); in f2fs_release_compress_blocks()
3740 f2fs_put_dnode(&dn); in f2fs_release_compress_blocks()
3776 static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count, in reserve_compress_blocks() argument
3779 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in reserve_compress_blocks()
3780 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in reserve_compress_blocks()
3785 blkaddr = data_blkaddr(dn->inode, dn->node_page, in reserve_compress_blocks()
3786 dn->ofs_in_node + i); in reserve_compress_blocks()
3802 blkaddr = data_blkaddr(dn->inode, dn->node_page, in reserve_compress_blocks()
3803 dn->ofs_in_node + i); in reserve_compress_blocks()
3807 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3832 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3836 ret = inc_valid_block_count(sbi, dn->inode, in reserve_compress_blocks()
3841 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in reserve_compress_blocks()
3842 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in reserve_compress_blocks()
3843 f2fs_set_data_blkaddr(dn, NEW_ADDR); in reserve_compress_blocks()
3846 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, true); in reserve_compress_blocks()
3894 struct dnode_of_data dn; in f2fs_reserve_compress_blocks() local
3899 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_reserve_compress_blocks()
3900 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_reserve_compress_blocks()
3904 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_reserve_compress_blocks()
3912 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_reserve_compress_blocks()
3913 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_reserve_compress_blocks()
3916 ret = reserve_compress_blocks(&dn, count, &reserved_blocks); in f2fs_reserve_compress_blocks()
3918 f2fs_put_dnode(&dn); in f2fs_reserve_compress_blocks()
4062 struct dnode_of_data dn; in f2fs_sec_trim_file() local
4066 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_sec_trim_file()
4067 ret = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in f2fs_sec_trim_file()
4070 index = f2fs_get_next_page_offset(&dn, index); in f2fs_sec_trim_file()
4076 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_sec_trim_file()
4077 count = min(end_offset - dn.ofs_in_node, pg_end - index); in f2fs_sec_trim_file()
4078 for (i = 0; i < count; i++, index++, dn.ofs_in_node++) { in f2fs_sec_trim_file()
4080 block_t blkaddr = f2fs_data_blkaddr(&dn); in f2fs_sec_trim_file()
4088 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
4109 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
4125 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()