Lines Matching refs:dn

58 	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(&dn, page->index); in f2fs_vm_page_mkwrite()
123 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_vm_page_mkwrite()
124 err = f2fs_get_dnode_of_data(&dn, page->index, LOOKUP_NODE); in f2fs_vm_page_mkwrite()
125 f2fs_put_dnode(&dn); in f2fs_vm_page_mkwrite()
136 f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); in f2fs_vm_page_mkwrite()
417 struct dnode_of_data dn; in f2fs_seek_block() local
443 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_seek_block()
444 err = f2fs_get_dnode_of_data(&dn, pgofs, LOOKUP_NODE); in f2fs_seek_block()
450 pgofs = f2fs_get_next_page_offset(&dn, pgofs); in f2fs_seek_block()
457 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_seek_block()
460 for (; dn.ofs_in_node < end_offset; in f2fs_seek_block()
461 dn.ofs_in_node++, pgofs++, in f2fs_seek_block()
465 blkaddr = f2fs_data_blkaddr(&dn); in f2fs_seek_block()
470 f2fs_put_dnode(&dn); in f2fs_seek_block()
476 f2fs_put_dnode(&dn); in f2fs_seek_block()
480 f2fs_put_dnode(&dn); in f2fs_seek_block()
554 void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count) in f2fs_truncate_data_blocks_range() argument
556 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_truncate_data_blocks_range()
558 int nr_free = 0, ofs = dn->ofs_in_node, len = count; in f2fs_truncate_data_blocks_range()
563 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in f2fs_truncate_data_blocks_range()
564 bool released = !atomic_read(&F2FS_I(dn->inode)->i_compr_blocks); in f2fs_truncate_data_blocks_range()
566 if (IS_INODE(dn->node_page) && f2fs_has_extra_attr(dn->inode)) in f2fs_truncate_data_blocks_range()
567 base = get_extra_isize(dn->inode); in f2fs_truncate_data_blocks_range()
569 raw_node = F2FS_NODE(dn->node_page); in f2fs_truncate_data_blocks_range()
573 for (; count > 0; count--, addr++, dn->ofs_in_node++, cluster_index++) { in f2fs_truncate_data_blocks_range()
576 if (f2fs_compressed_file(dn->inode) && in f2fs_truncate_data_blocks_range()
579 f2fs_i_compr_blocks_update(dn->inode, in f2fs_truncate_data_blocks_range()
588 dn->data_blkaddr = NULL_ADDR; in f2fs_truncate_data_blocks_range()
589 f2fs_set_data_blkaddr(dn); in f2fs_truncate_data_blocks_range()
599 if (dn->ofs_in_node == 0 && IS_INODE(dn->node_page)) in f2fs_truncate_data_blocks_range()
600 clear_inode_flag(dn->inode, FI_FIRST_BLOCK_WRITTEN); in f2fs_truncate_data_blocks_range()
609 f2fs_i_compr_blocks_update(dn->inode, valid_blocks, false); in f2fs_truncate_data_blocks_range()
617 fofs = f2fs_start_bidx_of_node(ofs_of_node(dn->node_page), in f2fs_truncate_data_blocks_range()
618 dn->inode) + ofs; in f2fs_truncate_data_blocks_range()
619 f2fs_update_extent_cache_range(dn, fofs, 0, len); in f2fs_truncate_data_blocks_range()
620 dec_valid_block_count(sbi, dn->inode, nr_free); in f2fs_truncate_data_blocks_range()
622 dn->ofs_in_node = ofs; in f2fs_truncate_data_blocks_range()
625 trace_f2fs_truncate_data_blocks_range(dn->inode, dn->nid, in f2fs_truncate_data_blocks_range()
626 dn->ofs_in_node, nr_free); in f2fs_truncate_data_blocks_range()
629 void f2fs_truncate_data_blocks(struct dnode_of_data *dn) in f2fs_truncate_data_blocks() argument
631 f2fs_truncate_data_blocks_range(dn, ADDRS_PER_BLOCK(dn->inode)); in f2fs_truncate_data_blocks()
671 struct dnode_of_data dn; in f2fs_do_truncate_blocks() local
700 set_new_dnode(&dn, inode, ipage, NULL, 0); in f2fs_do_truncate_blocks()
701 err = f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); in f2fs_do_truncate_blocks()
708 count = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_do_truncate_blocks()
710 count -= dn.ofs_in_node; in f2fs_do_truncate_blocks()
713 if (dn.ofs_in_node || IS_INODE(dn.node_page)) { in f2fs_do_truncate_blocks()
714 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_do_truncate_blocks()
718 f2fs_put_dnode(&dn); in f2fs_do_truncate_blocks()
1044 struct dnode_of_data dn; in f2fs_truncate_hole() local
1047 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_truncate_hole()
1048 err = f2fs_get_dnode_of_data(&dn, pg_start, LOOKUP_NODE); in f2fs_truncate_hole()
1051 pg_start = f2fs_get_next_page_offset(&dn, in f2fs_truncate_hole()
1058 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_truncate_hole()
1059 count = min(end_offset - dn.ofs_in_node, pg_end - pg_start); in f2fs_truncate_hole()
1063 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_truncate_hole()
1064 f2fs_put_dnode(&dn); in f2fs_truncate_hole()
1135 struct dnode_of_data dn; in __read_out_blkaddrs() local
1139 set_new_dnode(&dn, inode, NULL, NULL, 0); in __read_out_blkaddrs()
1140 ret = f2fs_get_dnode_of_data(&dn, off, LOOKUP_NODE_RA); in __read_out_blkaddrs()
1144 if (dn.max_level == 0) in __read_out_blkaddrs()
1147 dn.ofs_in_node, len); in __read_out_blkaddrs()
1153 done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, inode) - in __read_out_blkaddrs()
1154 dn.ofs_in_node, len); in __read_out_blkaddrs()
1155 for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) { in __read_out_blkaddrs()
1156 *blkaddr = f2fs_data_blkaddr(&dn); in __read_out_blkaddrs()
1161 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1168 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1173 f2fs_update_data_blkaddr(&dn, NULL_ADDR); in __read_out_blkaddrs()
1177 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1190 struct dnode_of_data dn; in __roll_back_blkaddrs() local
1197 set_new_dnode(&dn, inode, NULL, NULL, 0); in __roll_back_blkaddrs()
1198 ret = f2fs_get_dnode_of_data(&dn, off + i, LOOKUP_NODE_RA); in __roll_back_blkaddrs()
1203 f2fs_update_data_blkaddr(&dn, *blkaddr); in __roll_back_blkaddrs()
1205 f2fs_put_dnode(&dn); in __roll_back_blkaddrs()
1225 struct dnode_of_data dn; in __clone_blkaddrs() local
1230 set_new_dnode(&dn, dst_inode, NULL, NULL, 0); in __clone_blkaddrs()
1231 ret = f2fs_get_dnode_of_data(&dn, dst + i, ALLOC_NODE); in __clone_blkaddrs()
1235 ret = f2fs_get_node_info(sbi, dn.nid, &ni); in __clone_blkaddrs()
1237 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1242 ADDRS_PER_PAGE(dn.node_page, dst_inode) - in __clone_blkaddrs()
1243 dn.ofs_in_node, len - i); in __clone_blkaddrs()
1245 dn.data_blkaddr = f2fs_data_blkaddr(&dn); in __clone_blkaddrs()
1246 f2fs_truncate_data_blocks_range(&dn, 1); in __clone_blkaddrs()
1253 f2fs_replace_block(sbi, &dn, dn.data_blkaddr, in __clone_blkaddrs()
1258 dn.ofs_in_node++; in __clone_blkaddrs()
1265 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1409 static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start, in f2fs_do_zero_range() argument
1412 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_do_zero_range()
1414 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_do_zero_range()
1418 for (; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1419 if (f2fs_data_blkaddr(dn) == NULL_ADDR) in f2fs_do_zero_range()
1423 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1424 ret = f2fs_reserve_new_blocks(dn, count); in f2fs_do_zero_range()
1428 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1429 for (index = start; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1430 dn->data_blkaddr = f2fs_data_blkaddr(dn); in f2fs_do_zero_range()
1435 if (dn->data_blkaddr == NULL_ADDR) { in f2fs_do_zero_range()
1439 if (dn->data_blkaddr != NEW_ADDR) { in f2fs_do_zero_range()
1440 f2fs_invalidate_blocks(sbi, dn->data_blkaddr); in f2fs_do_zero_range()
1441 dn->data_blkaddr = NEW_ADDR; in f2fs_do_zero_range()
1442 f2fs_set_data_blkaddr(dn); in f2fs_do_zero_range()
1446 f2fs_update_extent_cache_range(dn, start, 0, index - start); in f2fs_do_zero_range()
1498 struct dnode_of_data dn; in f2fs_zero_range() local
1511 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_zero_range()
1512 ret = f2fs_get_dnode_of_data(&dn, index, ALLOC_NODE); in f2fs_zero_range()
1520 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_zero_range()
1521 end = min(pg_end, end_offset - dn.ofs_in_node + index); in f2fs_zero_range()
1523 ret = f2fs_do_zero_range(&dn, index, end); in f2fs_zero_range()
1524 f2fs_put_dnode(&dn); in f2fs_zero_range()
1530 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_zero_range()
3356 static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count) in release_compress_blocks() argument
3358 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in release_compress_blocks()
3360 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in release_compress_blocks()
3365 blkaddr = data_blkaddr(dn->inode, dn->node_page, in release_compress_blocks()
3366 dn->ofs_in_node + i); in release_compress_blocks()
3378 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in release_compress_blocks()
3379 blkaddr = f2fs_data_blkaddr(dn); in release_compress_blocks()
3384 dn->ofs_in_node += cluster_size; in release_compress_blocks()
3394 dn->data_blkaddr = NULL_ADDR; in release_compress_blocks()
3395 f2fs_set_data_blkaddr(dn); in release_compress_blocks()
3398 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, false); in release_compress_blocks()
3399 dec_valid_block_count(sbi, dn->inode, in release_compress_blocks()
3465 struct dnode_of_data dn; in f2fs_release_compress_blocks() local
3468 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_release_compress_blocks()
3469 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_release_compress_blocks()
3472 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_release_compress_blocks()
3480 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_release_compress_blocks()
3481 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_release_compress_blocks()
3484 ret = release_compress_blocks(&dn, count); in f2fs_release_compress_blocks()
3486 f2fs_put_dnode(&dn); in f2fs_release_compress_blocks()
3518 static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) in reserve_compress_blocks() argument
3520 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in reserve_compress_blocks()
3522 int cluster_size = F2FS_I(dn->inode)->i_cluster_size; in reserve_compress_blocks()
3527 blkaddr = data_blkaddr(dn->inode, dn->node_page, in reserve_compress_blocks()
3528 dn->ofs_in_node + i); in reserve_compress_blocks()
3542 for (i = 0; i < cluster_size; i++, dn->ofs_in_node++) { in reserve_compress_blocks()
3543 blkaddr = f2fs_data_blkaddr(dn); in reserve_compress_blocks()
3548 dn->ofs_in_node += cluster_size; in reserve_compress_blocks()
3557 dn->data_blkaddr = NEW_ADDR; in reserve_compress_blocks()
3558 f2fs_set_data_blkaddr(dn); in reserve_compress_blocks()
3562 ret = inc_valid_block_count(sbi, dn->inode, &reserved); in reserve_compress_blocks()
3569 f2fs_i_compr_blocks_update(dn->inode, compr_blocks, true); in reserve_compress_blocks()
3618 struct dnode_of_data dn; in f2fs_reserve_compress_blocks() local
3621 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_reserve_compress_blocks()
3622 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); in f2fs_reserve_compress_blocks()
3625 page_idx = f2fs_get_next_page_offset(&dn, in f2fs_reserve_compress_blocks()
3633 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_reserve_compress_blocks()
3634 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); in f2fs_reserve_compress_blocks()
3637 ret = reserve_compress_blocks(&dn, count); in f2fs_reserve_compress_blocks()
3639 f2fs_put_dnode(&dn); in f2fs_reserve_compress_blocks()
3779 struct dnode_of_data dn; in f2fs_sec_trim_file() local
3783 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_sec_trim_file()
3784 ret = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in f2fs_sec_trim_file()
3787 index = f2fs_get_next_page_offset(&dn, index); in f2fs_sec_trim_file()
3793 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_sec_trim_file()
3794 count = min(end_offset - dn.ofs_in_node, pg_end - index); in f2fs_sec_trim_file()
3795 for (i = 0; i < count; i++, index++, dn.ofs_in_node++) { in f2fs_sec_trim_file()
3797 block_t blkaddr = f2fs_data_blkaddr(&dn); in f2fs_sec_trim_file()
3805 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
3826 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()
3842 f2fs_put_dnode(&dn); in f2fs_sec_trim_file()