Lines Matching refs:path

212  * walk down backref nodes to find start of next reference path
476 struct btrfs_path *path;
486 path = btrfs_alloc_path();
487 if (!path) {
503 ret = btrfs_backref_add_tree_node(trans, cache, path, iter,
532 btrfs_free_path(path);
1019 struct btrfs_path *path;
1024 path = btrfs_alloc_path();
1025 if (!path)
1029 ret = btrfs_lookup_file_extent(NULL, root, path,
1038 leaf = path->nodes[0];
1039 fi = btrfs_item_ptr(leaf, path->slots[0],
1055 btrfs_free_path(path);
1192 struct btrfs_path *path, int level)
1197 btrfs_node_key(path->nodes[level], &key2, path->slots[level]);
1213 struct btrfs_path *path, struct btrfs_key *next_key,
1237 slot = path->slots[lowest_level];
1238 btrfs_node_key_to_cpu(path->nodes[lowest_level], &key, slot);
1284 eb = path->nodes[level];
1286 path->slots[level]);
1288 path->slots[level]);
1300 memcmp_node_keys(parent, slot, path, level)) {
1337 btrfs_node_key_to_cpu(path->nodes[level], &key,
1338 path->slots[level]);
1339 btrfs_release_path(path);
1341 path->lowest_level = level;
1343 ret = btrfs_search_slot(trans, src, &key, path, 0, 1);
1345 path->lowest_level = 0;
1368 path->nodes[level], path->slots[level],
1379 btrfs_set_node_blockptr(path->nodes[level],
1380 path->slots[level], old_bytenr);
1381 btrfs_set_node_ptr_generation(path->nodes[level],
1382 path->slots[level], old_ptr_gen);
1383 btrfs_mark_buffer_dirty(trans, path->nodes[level]);
1386 blocksize, path->nodes[level]->start);
1405 blocksize, path->nodes[level]->start);
1424 btrfs_unlock_up_safe(path, 0);
1438 int walk_up_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
1449 free_extent_buffer(path->nodes[i]);
1450 path->nodes[i] = NULL;
1453 for (i = *level; i < BTRFS_MAX_LEVEL && path->nodes[i]; i++) {
1454 eb = path->nodes[i];
1456 while (path->slots[i] + 1 < nritems) {
1457 path->slots[i]++;
1458 if (btrfs_node_ptr_generation(eb, path->slots[i]) <=
1465 free_extent_buffer(path->nodes[i]);
1466 path->nodes[i] = NULL;
1475 int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
1487 eb = path->nodes[i];
1489 while (path->slots[i] < nritems) {
1490 ptr_gen = btrfs_node_ptr_generation(eb, path->slots[i]);
1493 path->slots[i]++;
1495 if (path->slots[i] >= nritems) {
1506 eb = btrfs_read_node_slot(eb, path->slots[i]);
1510 path->nodes[i - 1] = eb;
1511 path->slots[i - 1] = 0;
1591 static int find_next_key(struct btrfs_path *path, int level,
1596 if (!path->nodes[level])
1598 if (path->slots[level] + 1 <
1599 btrfs_header_nritems(path->nodes[level])) {
1600 btrfs_node_key_to_cpu(path->nodes[level], key,
1601 path->slots[level] + 1);
1702 struct btrfs_path *path;
1711 path = btrfs_alloc_path();
1712 if (!path)
1714 path->reada = READA_FORWARD;
1722 path->nodes[level] = reloc_root->node;
1723 path->slots[level] = 0;
1729 path->lowest_level = level;
1730 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0);
1731 path->lowest_level = 0;
1733 btrfs_free_path(path);
1737 btrfs_node_key_to_cpu(path->nodes[level], &next_key,
1738 path->slots[level]);
1741 btrfs_unlock_up_safe(path, 0);
1785 ret = walk_down_reloc_tree(reloc_root, path, &level);
1791 if (!find_next_key(path, level, &key) &&
1795 ret = replace_path(trans, rc, root, reloc_root, path,
1802 btrfs_node_key_to_cpu(path->nodes[level], &key,
1803 path->slots[level]);
1807 ret = walk_up_reloc_tree(reloc_root, path, &level);
1816 btrfs_node_key(path->nodes[level], &root_item->drop_progress,
1817 path->slots[level]);
1839 btrfs_free_path(path);
2175 * This path is only for SHAREABLE roots, so if we come upon a
2185 "bytenr %llu doesn't have a backref path ending in a root",
2259 /* setup backref node path for btrfs_reloc_cow_block */
2261 rc->backref_cache.path[next->level] = next;
2295 * the way up a particular path, in this case return -EUCLEAN.
2406 struct btrfs_path *path, int lowest)
2424 path->lowest_level = node->level + 1;
2425 rc->backref_cache.path[node->level] = node;
2452 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
2457 btrfs_release_path(path);
2462 upper->eb = path->nodes[upper->level];
2463 path->nodes[upper->level] = NULL;
2465 BUG_ON(upper->eb != path->nodes[upper->level]);
2469 path->locks[upper->level] = 0;
2471 slot = path->slots[upper->level];
2472 btrfs_release_path(path);
2550 path->lowest_level = 0;
2563 struct btrfs_path *path)
2568 return do_relocation(trans, rc, node, &key, path, 0);
2573 struct btrfs_path *path, int err)
2589 ret = link_to_upper(trans, rc, node, path);
2674 struct btrfs_path *path)
2746 path->lowest_level = node->level;
2749 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
2750 btrfs_release_path(path);
2759 ret = do_relocation(trans, rc, node, key, path, 1);
2776 struct btrfs_path *path;
2782 path = btrfs_alloc_path();
2783 if (!path) {
2815 path);
2822 err = finish_pending_nodes(trans, rc, path, err);
2825 btrfs_free_path(path);
3197 struct btrfs_path *path,
3210 eb = path->nodes[0];
3211 item_size = btrfs_item_size(eb, path->slots[0]);
3217 ei = btrfs_item_ptr(eb, path->slots[0],
3264 eb->start, path->slots[0]);
3265 btrfs_release_path(path);
3269 btrfs_release_path(path);
3300 struct btrfs_path *path;
3311 path = btrfs_alloc_path();
3312 if (!path)
3324 path->search_commit_root = 1;
3325 path->skip_locking = 1;
3326 ret = btrfs_search_slot(NULL, rc->extent_root, &key, path, 0, 0);
3331 if (path->slots[0]) {
3332 path->slots[0]--;
3333 btrfs_item_key_to_cpu(path->nodes[0], &key,
3334 path->slots[0]);
3344 btrfs_release_path(path);
3350 btrfs_print_leaf(path->nodes[0]);
3359 ret = add_tree_block(rc, &key, path, blocks);
3361 btrfs_free_path(path);
3450 struct btrfs_path *path,
3459 btrfs_release_path(path);
3498 int find_next_extent(struct reloc_control *rc, struct btrfs_path *path,
3521 path->search_commit_root = 1;
3522 path->skip_locking = 1;
3523 ret = btrfs_search_slot(NULL, rc->extent_root, &key, path,
3528 leaf = path->nodes[0];
3529 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
3530 ret = btrfs_next_leaf(rc->extent_root, path);
3533 leaf = path->nodes[0];
3536 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
3544 path->slots[0]++;
3550 path->slots[0]++;
3557 path->slots[0]++;
3566 btrfs_release_path(path);
3578 btrfs_release_path(path);
3652 struct btrfs_path *path;
3659 path = btrfs_alloc_path();
3660 if (!path)
3662 path->reada = READA_FORWARD;
3693 ret = find_next_extent(rc, path, &key);
3701 ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
3703 flags = btrfs_extent_flags(path->nodes[0], ei);
3706 ret = add_tree_block(rc, &key, path, &blocks);
3709 ret = add_data_references(rc, &key, path, &blocks);
3711 btrfs_release_path(path);
3759 btrfs_release_path(path);
3810 btrfs_free_path(path);
3817 struct btrfs_path *path;
3822 path = btrfs_alloc_path();
3823 if (!path)
3826 ret = btrfs_insert_empty_inode(trans, root, path, objectid);
3830 leaf = path->nodes[0];
3831 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_inode_item);
3840 btrfs_free_path(path);
3847 struct btrfs_path *path;
3851 path = btrfs_alloc_path();
3852 if (!path) {
3860 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
3866 ret = btrfs_del_item(trans, root, path);
3870 btrfs_free_path(path);
4025 struct btrfs_path *path;
4085 path = btrfs_alloc_path();
4086 if (!path) {
4091 inode = lookup_free_space_inode(rc->block_group, path);
4092 btrfs_free_path(path);
4210 struct btrfs_path *path;
4217 path = btrfs_alloc_path();
4218 if (!path)
4220 path->reada = READA_BACK;
4228 path, 0, 0);
4234 if (path->slots[0] == 0)
4236 path->slots[0]--;
4238 leaf = path->nodes[0];
4239 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
4240 btrfs_release_path(path);
4279 btrfs_release_path(path);
4366 btrfs_free_path(path);
4450 node = rc->backref_cache.path[level];