Lines Matching refs:path
418 static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
438 eb = path->nodes[level];
446 * 1. We normally enter this function with the path already pointing to
455 eb = path->nodes[0];
456 if (path->slots[0] >= btrfs_header_nritems(eb) ||
460 ret = btrfs_next_leaf(root, path);
462 ret = btrfs_next_old_leaf(root, path, time_seq);
466 eb = path->nodes[0];
467 slot = path->slots[0];
484 ret = btrfs_next_leaf(root, path);
486 ret = btrfs_next_old_leaf(root, path, time_seq);
525 ret = btrfs_next_item(root, path);
527 ret = btrfs_next_old_item(root, path, time_seq);
542 struct btrfs_path *path, u64 time_seq,
562 if (path->search_commit_root)
563 root = btrfs_get_fs_root_commit_root(fs_info, path, ref->root_id);
571 if (!path->search_commit_root &&
582 if (path->search_commit_root)
614 path->lowest_level = level;
616 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
618 ret = btrfs_search_old_slot(root, &search_key, path, time_seq);
628 eb = path->nodes[level];
635 eb = path->nodes[level];
638 ret = add_all_parents(root, path, parents, preftrees, ref, level,
643 path->lowest_level = 0;
644 btrfs_release_path(path);
685 struct btrfs_path *path, u64 time_seq,
731 err = resolve_indirect_ref(fs_info, path, time_seq, preftrees,
964 struct btrfs_path *path, u64 bytenr,
982 leaf = path->nodes[0];
983 slot = path->slots[0];
1087 struct btrfs_path *path, u64 bytenr,
1098 ret = btrfs_next_item(extent_root, path);
1106 slot = path->slots[0];
1107 leaf = path->nodes[0];
1209 struct btrfs_path *path;
1230 path = btrfs_alloc_path();
1231 if (!path)
1234 path->search_commit_root = 1;
1235 path->skip_locking = 1;
1239 path->skip_locking = 1;
1242 * grab both a lock on the path and a lock on the delayed ref head.
1249 ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0);
1277 btrfs_release_path(path);
1299 if (path->slots[0]) {
1303 path->slots[0]--;
1304 leaf = path->nodes[0];
1305 slot = path->slots[0];
1310 ret = add_inline_refs(fs_info, path, bytenr,
1314 ret = add_keyed_refs(fs_info, path, bytenr, info_level,
1321 btrfs_release_path(path);
1323 ret = add_missing_keys(fs_info, &preftrees, path->skip_locking == 0);
1329 ret = resolve_indirect_refs(fs_info, path, time_seq, &preftrees,
1385 if (!path->skip_locking) {
1391 if (!path->skip_locking)
1441 btrfs_free_path(path);
1629 u64 start_off, struct btrfs_path *path,
1644 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
1649 leaf = path->nodes[0];
1650 slot = path->slots[0];
1661 ret = btrfs_next_leaf(root, path);
1685 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
1697 * this iterates to turn a name (from iref/extref) into a full filesystem path.
1698 * Elements of the path are separated by '/' and the path is guaranteed to be
1699 * 0-terminated. the path is only given within the current file system.
1704 * in case the path buffer would overflow, the pointer is decremented further
1707 * required for the path to fit into the buffer. in that case, the returned
1710 char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
1721 int leave_spinning = path->leave_spinning;
1727 path->leave_spinning = 1;
1734 if (!path->skip_locking)
1738 ret = btrfs_find_item(fs_root, path, parent, 0,
1751 slot = path->slots[0];
1752 eb = path->nodes[0];
1753 /* make sure we can use eb after releasing the path */
1755 if (!path->skip_locking)
1757 path->nodes[0] = NULL;
1758 path->locks[0] = 0;
1760 btrfs_release_path(path);
1772 btrfs_release_path(path);
1773 path->leave_spinning = leave_spinning;
1782 * this makes the path point to (logical EXTENT_ITEM *)
1787 struct btrfs_path *path, struct btrfs_key *found_key,
1805 ret = btrfs_search_slot(NULL, fs_info->extent_root, &key, path, 0, 0);
1809 ret = btrfs_previous_extent_item(fs_info->extent_root, path, 0);
1815 btrfs_item_key_to_cpu(path->nodes[0], found_key, path->slots[0]);
1828 eb = path->nodes[0];
1829 item_size = btrfs_item_size_nr(eb, path->slots[0]);
1832 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item);
2088 struct btrfs_path *path,
2095 int search_commit_root = path->search_commit_root;
2097 ret = extent_from_logical(fs_info, logical, path, &found_key, &flags);
2098 btrfs_release_path(path);
2116 struct btrfs_path *path,
2132 ret = btrfs_find_item(fs_root, path, inum,
2145 slot = path->slots[0];
2146 eb = btrfs_clone_extent_buffer(path->nodes[0]);
2151 btrfs_release_path(path);
2158 /* path must be released before calling iterate()! */
2173 btrfs_release_path(path);
2179 struct btrfs_path *path,
2194 ret = btrfs_find_one_extref(fs_root, inum, offset, path, &extref,
2204 slot = path->slots[0];
2205 eb = btrfs_clone_extent_buffer(path->nodes[0]);
2210 btrfs_release_path(path);
2235 btrfs_release_path(path);
2241 struct btrfs_path *path, iterate_irefs_t *iterate,
2247 ret = iterate_inode_refs(inum, fs_root, path, iterate, ctx);
2253 ret = iterate_inode_extrefs(inum, fs_root, path, iterate, ctx);
2261 * returns 0 if the path could be dumped (probably truncated)
2298 * is has been created large enough. each path is zero-terminated and accessed
2338 * total_bytes to allocate are passed, note that space usable for actual path
2343 struct btrfs_path *path)
2358 ifp->btrfs_path = path;
2382 ret->path = btrfs_alloc_path();
2383 if (!ret->path) {
2389 ret->path->search_commit_root = 1;
2390 ret->path->skip_locking = 1;
2399 struct btrfs_path *path = iter->path;
2409 ret = btrfs_search_slot(NULL, fs_info->extent_root, &key, path, 0, 0);
2416 if (path->slots[0] == 0) {
2421 path->slots[0]--;
2423 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
2430 iter->item_ptr = (u32)btrfs_item_ptr_offset(path->nodes[0],
2431 path->slots[0]);
2433 btrfs_item_size_nr(path->nodes[0], path->slots[0]));
2434 ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
2444 if (btrfs_extent_flags(path->nodes[0], ei) & BTRFS_EXTENT_FLAG_DATA) {
2452 ret = btrfs_next_item(fs_info->extent_root, path);
2462 btrfs_item_key_to_cpu(path->nodes[0], &iter->cur_key,
2463 path->slots[0]);
2470 iter->cur_ptr = (u32)btrfs_item_ptr_offset(path->nodes[0],
2471 path->slots[0]);
2474 path->nodes[0], path->slots[0]));
2496 struct btrfs_path *path = iter->path;
2526 ret = btrfs_next_item(iter->fs_info->extent_root, iter->path);
2530 btrfs_item_key_to_cpu(path->nodes[0], &iter->cur_key, path->slots[0]);
2535 iter->item_ptr = (u32)btrfs_item_ptr_offset(path->nodes[0],
2536 path->slots[0]);
2538 iter->end_ptr = iter->item_ptr + (u32)btrfs_item_size_nr(path->nodes[0],
2539 path->slots[0]);
2594 * upper edges and any uncached nodes in the path.
2744 * @path: A clean (released) path, to avoid allocating path everytime
2748 struct btrfs_path *path,
2795 path->search_commit_root = 1;
2796 path->skip_locking = 1;
2797 path->lowest_level = level;
2798 ret = btrfs_search_slot(NULL, root, tree_key, path, 0, 0);
2799 path->lowest_level = 0;
2804 if (ret > 0 && path->slots[level] > 0)
2805 path->slots[level]--;
2807 eb = path->nodes[level];
2808 if (btrfs_node_blockptr(eb, path->slots[level]) != cur->bytenr) {
2819 /* Add all nodes and edges in the path */
2821 if (!path->nodes[level]) {
2842 eb = path->nodes[level];
2898 btrfs_release_path(path);
2909 * @path: Released path for indirect tree backref lookup
2914 struct btrfs_path *path,
3023 ret = handle_indirect_tree_backref(cache, path, &key, node_key,