Lines Matching full:dn

1117 static void __set_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr)  in __set_data_blkaddr()  argument
1119 __le32 *addr = get_dnode_addr(dn->inode, dn->node_page); in __set_data_blkaddr()
1121 dn->data_blkaddr = blkaddr; in __set_data_blkaddr()
1122 addr[dn->ofs_in_node] = cpu_to_le32(dn->data_blkaddr); in __set_data_blkaddr()
1131 void f2fs_set_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr) in f2fs_set_data_blkaddr() argument
1133 f2fs_wait_on_page_writeback(dn->node_page, NODE, true, true); in f2fs_set_data_blkaddr()
1134 __set_data_blkaddr(dn, blkaddr); in f2fs_set_data_blkaddr()
1135 if (set_page_dirty(dn->node_page)) in f2fs_set_data_blkaddr()
1136 dn->node_changed = true; in f2fs_set_data_blkaddr()
1139 void f2fs_update_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr) in f2fs_update_data_blkaddr() argument
1141 f2fs_set_data_blkaddr(dn, blkaddr); in f2fs_update_data_blkaddr()
1142 f2fs_update_read_extent_cache(dn); in f2fs_update_data_blkaddr()
1145 /* dn->ofs_in_node will be returned with up-to-date last block pointer */
1146 int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count) in f2fs_reserve_new_blocks() argument
1148 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_reserve_new_blocks()
1154 if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC))) in f2fs_reserve_new_blocks()
1156 err = inc_valid_block_count(sbi, dn->inode, &count, true); in f2fs_reserve_new_blocks()
1160 trace_f2fs_reserve_new_blocks(dn->inode, dn->nid, in f2fs_reserve_new_blocks()
1161 dn->ofs_in_node, count); in f2fs_reserve_new_blocks()
1163 f2fs_wait_on_page_writeback(dn->node_page, NODE, true, true); in f2fs_reserve_new_blocks()
1165 for (; count > 0; dn->ofs_in_node++) { in f2fs_reserve_new_blocks()
1166 block_t blkaddr = f2fs_data_blkaddr(dn); in f2fs_reserve_new_blocks()
1169 __set_data_blkaddr(dn, NEW_ADDR); in f2fs_reserve_new_blocks()
1174 if (set_page_dirty(dn->node_page)) in f2fs_reserve_new_blocks()
1175 dn->node_changed = true; in f2fs_reserve_new_blocks()
1179 /* Should keep dn->ofs_in_node unchanged */
1180 int f2fs_reserve_new_block(struct dnode_of_data *dn) in f2fs_reserve_new_block() argument
1182 unsigned int ofs_in_node = dn->ofs_in_node; in f2fs_reserve_new_block()
1185 ret = f2fs_reserve_new_blocks(dn, 1); in f2fs_reserve_new_block()
1186 dn->ofs_in_node = ofs_in_node; in f2fs_reserve_new_block()
1190 int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index) in f2fs_reserve_block() argument
1192 bool need_put = dn->inode_page ? false : true; in f2fs_reserve_block()
1195 err = f2fs_get_dnode_of_data(dn, index, ALLOC_NODE); in f2fs_reserve_block()
1199 if (dn->data_blkaddr == NULL_ADDR) in f2fs_reserve_block()
1200 err = f2fs_reserve_new_block(dn); in f2fs_reserve_block()
1202 f2fs_put_dnode(dn); in f2fs_reserve_block()
1211 struct dnode_of_data dn; in f2fs_get_read_data_page() local
1220 &dn.data_blkaddr)) { in f2fs_get_read_data_page()
1221 if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), dn.data_blkaddr, in f2fs_get_read_data_page()
1229 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_get_read_data_page()
1230 err = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in f2fs_get_read_data_page()
1233 *next_pgofs = f2fs_get_next_page_offset(&dn, index); in f2fs_get_read_data_page()
1236 f2fs_put_dnode(&dn); in f2fs_get_read_data_page()
1238 if (unlikely(dn.data_blkaddr == NULL_ADDR)) { in f2fs_get_read_data_page()
1244 if (dn.data_blkaddr != NEW_ADDR && in f2fs_get_read_data_page()
1246 dn.data_blkaddr, in f2fs_get_read_data_page()
1264 if (dn.data_blkaddr == NEW_ADDR) { in f2fs_get_read_data_page()
1272 err = f2fs_submit_page_read(inode, page_folio(page), dn.data_blkaddr, in f2fs_get_read_data_page()
1347 struct dnode_of_data dn; in f2fs_get_new_data_page() local
1360 set_new_dnode(&dn, inode, ipage, NULL, 0); in f2fs_get_new_data_page()
1361 err = f2fs_reserve_block(&dn, index); in f2fs_get_new_data_page()
1367 f2fs_put_dnode(&dn); in f2fs_get_new_data_page()
1372 if (dn.data_blkaddr == NEW_ADDR) { in f2fs_get_new_data_page()
1392 static int __allocate_data_block(struct dnode_of_data *dn, int seg_type) in __allocate_data_block() argument
1394 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in __allocate_data_block()
1401 if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC))) in __allocate_data_block()
1404 err = f2fs_get_node_info(sbi, dn->nid, &ni, false); in __allocate_data_block()
1408 dn->data_blkaddr = f2fs_data_blkaddr(dn); in __allocate_data_block()
1409 if (dn->data_blkaddr == NULL_ADDR) { in __allocate_data_block()
1410 err = inc_valid_block_count(sbi, dn->inode, &count, true); in __allocate_data_block()
1415 set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); in __allocate_data_block()
1416 old_blkaddr = dn->data_blkaddr; in __allocate_data_block()
1418 &dn->data_blkaddr, &sum, seg_type, NULL); in __allocate_data_block()
1425 f2fs_update_data_blkaddr(dn, dn->data_blkaddr); in __allocate_data_block()
1445 int f2fs_get_block_locked(struct dnode_of_data *dn, pgoff_t index) in f2fs_get_block_locked() argument
1447 struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); in f2fs_get_block_locked()
1451 if (!f2fs_lookup_read_extent_cache_block(dn->inode, index, in f2fs_get_block_locked()
1452 &dn->data_blkaddr)) in f2fs_get_block_locked()
1453 err = f2fs_reserve_block(dn, index); in f2fs_get_block_locked()
1460 struct f2fs_map_blocks *map, struct dnode_of_data *dn, in f2fs_map_no_dnode() argument
1475 *map->m_next_pgofs = f2fs_get_next_page_offset(dn, pgoff); in f2fs_map_no_dnode()
1477 *map->m_next_extent = f2fs_get_next_page_offset(dn, pgoff); in f2fs_map_no_dnode()
1543 struct dnode_of_data dn; in f2fs_map_blocks() local
1577 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_map_blocks()
1578 err = f2fs_get_dnode_of_data(&dn, pgofs, mode); in f2fs_map_blocks()
1583 err = f2fs_map_no_dnode(inode, map, &dn, pgofs); in f2fs_map_blocks()
1589 last_ofs_in_node = ofs_in_node = dn.ofs_in_node; in f2fs_map_blocks()
1590 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); in f2fs_map_blocks()
1593 blkaddr = f2fs_data_blkaddr(&dn); in f2fs_map_blocks()
1614 last_ofs_in_node = dn.ofs_in_node; in f2fs_map_blocks()
1619 err = __allocate_data_block(&dn, map->m_seg_type); in f2fs_map_blocks()
1632 blkaddr = dn.data_blkaddr; in f2fs_map_blocks()
1637 f2fs_sanity_check_cluster(&dn)) { in f2fs_map_blocks()
1695 dn.ofs_in_node++; in f2fs_map_blocks()
1700 (pgofs == end || dn.ofs_in_node == end_offset)) { in f2fs_map_blocks()
1702 dn.ofs_in_node = ofs_in_node; in f2fs_map_blocks()
1703 err = f2fs_reserve_new_blocks(&dn, prealloc); in f2fs_map_blocks()
1707 map->m_len += dn.ofs_in_node - ofs_in_node; in f2fs_map_blocks()
1708 if (prealloc && dn.ofs_in_node != last_ofs_in_node + 1) { in f2fs_map_blocks()
1712 dn.ofs_in_node = end_offset; in f2fs_map_blocks()
1725 else if (dn.ofs_in_node < end_offset) in f2fs_map_blocks()
1732 f2fs_update_read_extent_cache_range(&dn, in f2fs_map_blocks()
1738 f2fs_put_dnode(&dn); in f2fs_map_blocks()
1742 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_map_blocks()
1777 f2fs_update_read_extent_cache_range(&dn, in f2fs_map_blocks()
1784 f2fs_put_dnode(&dn); in f2fs_map_blocks()
1788 f2fs_balance_fs(sbi, dn.node_changed); in f2fs_map_blocks()
2197 struct dnode_of_data dn; in f2fs_read_multi_pages() local
2248 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_read_multi_pages()
2249 ret = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE); in f2fs_read_multi_pages()
2257 f2fs_bug_on(sbi, dn.data_blkaddr != COMPRESS_ADDR); in f2fs_read_multi_pages()
2263 blkaddr = from_dnode ? data_blkaddr(dn.inode, dn.node_page, in f2fs_read_multi_pages()
2264 dn.ofs_in_node + i) : in f2fs_read_multi_pages()
2297 blkaddr = from_dnode ? data_blkaddr(dn.inode, dn.node_page, in f2fs_read_multi_pages()
2298 dn.ofs_in_node + i + 1) : in f2fs_read_multi_pages()
2327 f2fs_put_dnode(&dn); in f2fs_read_multi_pages()
2346 f2fs_put_dnode(&dn); in f2fs_read_multi_pages()
2353 f2fs_put_dnode(&dn); in f2fs_read_multi_pages()
2661 struct dnode_of_data dn; in f2fs_do_write_data_page() local
2671 set_new_dnode(&dn, F2FS_I(inode)->cow_inode, NULL, NULL, 0); in f2fs_do_write_data_page()
2673 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_do_write_data_page()
2691 err = f2fs_get_dnode_of_data(&dn, folio->index, LOOKUP_NODE); in f2fs_do_write_data_page()
2695 fio->old_blkaddr = dn.data_blkaddr; in f2fs_do_write_data_page()
2727 f2fs_put_dnode(&dn); in f2fs_do_write_data_page()
2750 err = f2fs_get_node_info(fio->sbi, dn.nid, &ni, false); in f2fs_do_write_data_page()
2766 f2fs_outplace_write_data(&dn, fio); in f2fs_do_write_data_page()
2772 f2fs_put_dnode(&dn); in f2fs_do_write_data_page()
3395 struct dnode_of_data dn; in prepare_write_begin() local
3427 set_new_dnode(&dn, inode, ipage, ipage, 0); in prepare_write_begin()
3437 err = f2fs_convert_inline_page(&dn, folio_page(folio, 0)); in prepare_write_begin()
3438 if (err || dn.data_blkaddr != NULL_ADDR) in prepare_write_begin()
3443 &dn.data_blkaddr)) { in prepare_write_begin()
3445 err = f2fs_reserve_block(&dn, index); in prepare_write_begin()
3450 err = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in prepare_write_begin()
3451 if (!err && dn.data_blkaddr != NULL_ADDR) in prepare_write_begin()
3453 f2fs_put_dnode(&dn); in prepare_write_begin()
3462 *blk_addr = dn.data_blkaddr; in prepare_write_begin()
3463 *node_changed = dn.node_changed; in prepare_write_begin()
3465 f2fs_put_dnode(&dn); in prepare_write_begin()
3475 struct dnode_of_data dn; in __find_data_block() local
3483 set_new_dnode(&dn, inode, ipage, ipage, 0); in __find_data_block()
3486 &dn.data_blkaddr)) { in __find_data_block()
3488 err = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); in __find_data_block()
3490 dn.data_blkaddr = NULL_ADDR; in __find_data_block()
3494 *blk_addr = dn.data_blkaddr; in __find_data_block()
3495 f2fs_put_dnode(&dn); in __find_data_block()
3503 struct dnode_of_data dn; in __reserve_data_block() local
3514 set_new_dnode(&dn, inode, ipage, ipage, 0); in __reserve_data_block()
3516 if (!f2fs_lookup_read_extent_cache_block(dn.inode, index, in __reserve_data_block()
3517 &dn.data_blkaddr)) in __reserve_data_block()
3518 err = f2fs_reserve_block(&dn, index); in __reserve_data_block()
3520 *blk_addr = dn.data_blkaddr; in __reserve_data_block()
3521 *node_changed = dn.node_changed; in __reserve_data_block()
3522 f2fs_put_dnode(&dn); in __reserve_data_block()
3819 struct dnode_of_data dn; in f2fs_bmap_compress() local
3825 set_new_dnode(&dn, inode, NULL, NULL, 0); in f2fs_bmap_compress()
3826 ret = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE); in f2fs_bmap_compress()
3830 if (dn.data_blkaddr != COMPRESS_ADDR) { in f2fs_bmap_compress()
3831 dn.ofs_in_node += block - start_idx; in f2fs_bmap_compress()
3832 blknr = f2fs_data_blkaddr(&dn); in f2fs_bmap_compress()
3837 f2fs_put_dnode(&dn); in f2fs_bmap_compress()