Lines Matching refs:dn

53 	struct dnode_of_data dn;  in f2fs_vm_page_mkwrite()  local
67 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_vm_page_mkwrite()
68 err = f2fs_reserve_block(&dn, page->index); in f2fs_vm_page_mkwrite()
73 f2fs_put_dnode(&dn); in f2fs_vm_page_mkwrite()
76 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_vm_page_mkwrite()
115 f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); in f2fs_vm_page_mkwrite()
377 struct dnode_of_data dn; in f2fs_seek_block() local
401 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_seek_block()
402 err = f2fs_get_dnode_of_data(&dn, pgofs, LOOKUP_NODE); in f2fs_seek_block()
408 pgofs = f2fs_get_next_page_offset(&dn, pgofs); in f2fs_seek_block()
415 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_seek_block()
418 for (; dn.ofs_in_node < end_offset; in f2fs_seek_block()
419 dn.ofs_in_node++, pgofs++, in f2fs_seek_block()
423 blkaddr = datablock_addr(dn.inode, in f2fs_seek_block()
424 dn.node_page, dn.ofs_in_node); in f2fs_seek_block()
429 f2fs_put_dnode(&dn); in f2fs_seek_block()
435 f2fs_put_dnode(&dn); in f2fs_seek_block()
439 f2fs_put_dnode(&dn); in f2fs_seek_block()
505 void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count) in f2fs_truncate_data_blocks_range() argument
507 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_truncate_data_blocks_range()
509 int nr_free = 0, ofs = dn->ofs_in_node, len = count; in f2fs_truncate_data_blocks_range()
513 if (IS_INODE(dn->node_page) && f2fs_has_extra_attr(dn->inode)) in f2fs_truncate_data_blocks_range()
514 base = get_extra_isize(dn->inode); in f2fs_truncate_data_blocks_range()
516 raw_node = F2FS_NODE(dn->node_page); in f2fs_truncate_data_blocks_range()
519 for (; count > 0; count--, addr++, dn->ofs_in_node++) { in f2fs_truncate_data_blocks_range()
525 dn->data_blkaddr = NULL_ADDR; in f2fs_truncate_data_blocks_range()
526 f2fs_set_data_blkaddr(dn); in f2fs_truncate_data_blocks_range()
533 if (dn->ofs_in_node == 0 && IS_INODE(dn->node_page)) in f2fs_truncate_data_blocks_range()
534 clear_inode_flag(dn->inode, FI_FIRST_BLOCK_WRITTEN); in f2fs_truncate_data_blocks_range()
544 fofs = f2fs_start_bidx_of_node(ofs_of_node(dn->node_page), in f2fs_truncate_data_blocks_range()
545 dn->inode) + ofs; in f2fs_truncate_data_blocks_range()
546 f2fs_update_extent_cache_range(dn, fofs, 0, len); in f2fs_truncate_data_blocks_range()
547 dec_valid_block_count(sbi, dn->inode, nr_free); in f2fs_truncate_data_blocks_range()
549 dn->ofs_in_node = ofs; in f2fs_truncate_data_blocks_range()
552 trace_f2fs_truncate_data_blocks_range(dn->inode, dn->nid, in f2fs_truncate_data_blocks_range()
553 dn->ofs_in_node, nr_free); in f2fs_truncate_data_blocks_range()
556 void f2fs_truncate_data_blocks(struct dnode_of_data *dn) in f2fs_truncate_data_blocks() argument
558 f2fs_truncate_data_blocks_range(dn, ADDRS_PER_BLOCK); in f2fs_truncate_data_blocks()
598 struct dnode_of_data dn; in f2fs_truncate_blocks() local
627 set_new_dnode(&dn, inode, ipage, NULL, 0); in f2fs_truncate_blocks()
628 err = f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); in f2fs_truncate_blocks()
635 count = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_truncate_blocks()
637 count -= dn.ofs_in_node; in f2fs_truncate_blocks()
640 if (dn.ofs_in_node || IS_INODE(dn.node_page)) { in f2fs_truncate_blocks()
641 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_truncate_blocks()
645 f2fs_put_dnode(&dn); in f2fs_truncate_blocks()
898 struct dnode_of_data dn; in f2fs_truncate_hole() local
901 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_truncate_hole()
902 err = f2fs_get_dnode_of_data(&dn, pg_start, LOOKUP_NODE); in f2fs_truncate_hole()
905 pg_start = f2fs_get_next_page_offset(&dn, in f2fs_truncate_hole()
912 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_truncate_hole()
913 count = min(end_offset - dn.ofs_in_node, pg_end - pg_start); in f2fs_truncate_hole()
917 f2fs_truncate_data_blocks_range(&dn, count); in f2fs_truncate_hole()
918 f2fs_put_dnode(&dn); in f2fs_truncate_hole()
989 struct dnode_of_data dn; in __read_out_blkaddrs() local
993 set_new_dnode(&dn, inode, NULL, NULL, 0); in __read_out_blkaddrs()
994 ret = f2fs_get_dnode_of_data(&dn, off, LOOKUP_NODE_RA); in __read_out_blkaddrs()
998 if (dn.max_level == 0) in __read_out_blkaddrs()
1000 done = min((pgoff_t)ADDRS_PER_BLOCK - dn.ofs_in_node, len); in __read_out_blkaddrs()
1006 done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, inode) - in __read_out_blkaddrs()
1007 dn.ofs_in_node, len); in __read_out_blkaddrs()
1008 for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) { in __read_out_blkaddrs()
1009 *blkaddr = datablock_addr(dn.inode, in __read_out_blkaddrs()
1010 dn.node_page, dn.ofs_in_node); in __read_out_blkaddrs()
1014 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1019 f2fs_update_data_blkaddr(&dn, NULL_ADDR); in __read_out_blkaddrs()
1023 f2fs_put_dnode(&dn); in __read_out_blkaddrs()
1036 struct dnode_of_data dn; in __roll_back_blkaddrs() local
1043 set_new_dnode(&dn, inode, NULL, NULL, 0); in __roll_back_blkaddrs()
1044 ret = f2fs_get_dnode_of_data(&dn, off + i, LOOKUP_NODE_RA); in __roll_back_blkaddrs()
1049 f2fs_update_data_blkaddr(&dn, *blkaddr); in __roll_back_blkaddrs()
1051 f2fs_put_dnode(&dn); in __roll_back_blkaddrs()
1071 struct dnode_of_data dn; in __clone_blkaddrs() local
1076 set_new_dnode(&dn, dst_inode, NULL, NULL, 0); in __clone_blkaddrs()
1077 ret = f2fs_get_dnode_of_data(&dn, dst + i, ALLOC_NODE); in __clone_blkaddrs()
1081 ret = f2fs_get_node_info(sbi, dn.nid, &ni); in __clone_blkaddrs()
1083 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1088 ADDRS_PER_PAGE(dn.node_page, dst_inode) - in __clone_blkaddrs()
1089 dn.ofs_in_node, len - i); in __clone_blkaddrs()
1091 dn.data_blkaddr = datablock_addr(dn.inode, in __clone_blkaddrs()
1092 dn.node_page, dn.ofs_in_node); in __clone_blkaddrs()
1093 f2fs_truncate_data_blocks_range(&dn, 1); in __clone_blkaddrs()
1100 f2fs_replace_block(sbi, &dn, dn.data_blkaddr, in __clone_blkaddrs()
1105 dn.ofs_in_node++; in __clone_blkaddrs()
1112 f2fs_put_dnode(&dn); in __clone_blkaddrs()
1258 static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start, in f2fs_do_zero_range() argument
1261 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_do_zero_range()
1263 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_do_zero_range()
1267 for (; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1268 if (datablock_addr(dn->inode, dn->node_page, in f2fs_do_zero_range()
1269 dn->ofs_in_node) == NULL_ADDR) in f2fs_do_zero_range()
1273 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1274 ret = f2fs_reserve_new_blocks(dn, count); in f2fs_do_zero_range()
1278 dn->ofs_in_node = ofs_in_node; in f2fs_do_zero_range()
1279 for (index = start; index < end; index++, dn->ofs_in_node++) { in f2fs_do_zero_range()
1280 dn->data_blkaddr = datablock_addr(dn->inode, in f2fs_do_zero_range()
1281 dn->node_page, dn->ofs_in_node); in f2fs_do_zero_range()
1286 if (dn->data_blkaddr == NULL_ADDR) { in f2fs_do_zero_range()
1290 if (dn->data_blkaddr != NEW_ADDR) { in f2fs_do_zero_range()
1291 f2fs_invalidate_blocks(sbi, dn->data_blkaddr); in f2fs_do_zero_range()
1292 dn->data_blkaddr = NEW_ADDR; in f2fs_do_zero_range()
1293 f2fs_set_data_blkaddr(dn); in f2fs_do_zero_range()
1297 f2fs_update_extent_cache_range(dn, start, 0, index - start); in f2fs_do_zero_range()
1349 struct dnode_of_data dn; in f2fs_zero_range() local
1362 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_zero_range()
1363 ret = f2fs_get_dnode_of_data(&dn, index, ALLOC_NODE); in f2fs_zero_range()
1371 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_zero_range()
1372 end = min(pg_end, end_offset - dn.ofs_in_node + index); in f2fs_zero_range()
1374 ret = f2fs_do_zero_range(&dn, index, end); in f2fs_zero_range()
1375 f2fs_put_dnode(&dn); in f2fs_zero_range()
1381 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_zero_range()