Lines Matching refs:path
499 struct btrfs_path *path; in alloc_path_for_send() local
501 path = btrfs_alloc_path(); in alloc_path_for_send()
502 if (!path) in alloc_path_for_send()
504 path->search_commit_root = 1; in alloc_path_for_send()
505 path->skip_locking = 1; in alloc_path_for_send()
506 path->need_commit_sem = 1; in alloc_path_for_send()
507 return path; in alloc_path_for_send()
719 struct fs_path *path, struct fs_path *lnk) in send_link() argument
723 verbose_printk("btrfs: send_link %s -> %s\n", path->start, lnk->start); in send_link()
729 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, path); in send_link()
742 static int send_unlink(struct send_ctx *sctx, struct fs_path *path) in send_unlink() argument
746 verbose_printk("btrfs: send_unlink %s\n", path->start); in send_unlink()
752 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, path); in send_unlink()
764 static int send_rmdir(struct send_ctx *sctx, struct fs_path *path) in send_rmdir() argument
768 verbose_printk("btrfs: send_rmdir %s\n", path->start); in send_rmdir()
774 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, path); in send_rmdir()
786 static int __get_inode_info(struct btrfs_root *root, struct btrfs_path *path, in __get_inode_info() argument
797 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in __get_inode_info()
804 ii = btrfs_item_ptr(path->nodes[0], path->slots[0], in __get_inode_info()
807 *size = btrfs_inode_size(path->nodes[0], ii); in __get_inode_info()
809 *gen = btrfs_inode_generation(path->nodes[0], ii); in __get_inode_info()
811 *mode = btrfs_inode_mode(path->nodes[0], ii); in __get_inode_info()
813 *uid = btrfs_inode_uid(path->nodes[0], ii); in __get_inode_info()
815 *gid = btrfs_inode_gid(path->nodes[0], ii); in __get_inode_info()
817 *rdev = btrfs_inode_rdev(path->nodes[0], ii); in __get_inode_info()
827 struct btrfs_path *path; in get_inode_info() local
830 path = alloc_path_for_send(); in get_inode_info()
831 if (!path) in get_inode_info()
833 ret = __get_inode_info(root, path, ino, size, gen, mode, uid, gid, in get_inode_info()
835 btrfs_free_path(path); in get_inode_info()
851 static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path, in iterate_inode_ref() argument
855 struct extent_buffer *eb = path->nodes[0]; in iterate_inode_ref()
863 int slot = path->slots[0]; in iterate_inode_ref()
971 static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path, in iterate_dir_item() argument
1004 eb = path->nodes[0]; in iterate_dir_item()
1005 slot = path->slots[0]; in iterate_dir_item()
1103 u64 ino, struct fs_path *path) in get_inode_path() argument
1113 fs_path_reset(path); in get_inode_path()
1135 __copy_first_ref, path); in get_inode_path()
1148 struct btrfs_path *path; member
1222 ret = __get_inode_info(found->root, bctx->path, ino, &i_size, NULL, NULL, in __iterate_backrefs()
1224 btrfs_release_path(bctx->path); in __iterate_backrefs()
1278 struct btrfs_path *path, in find_extent_clone() argument
1291 struct extent_buffer *eb = path->nodes[0]; in find_extent_clone()
1312 backref_ctx->path = tmp_path; in find_extent_clone()
1324 fi = btrfs_item_ptr(eb, path->slots[0], in find_extent_clone()
1454 struct btrfs_path *path; in read_symlink() local
1462 path = alloc_path_for_send(); in read_symlink()
1463 if (!path) in read_symlink()
1469 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in read_symlink()
1488 ei = btrfs_item_ptr(path->nodes[0], path->slots[0], in read_symlink()
1490 type = btrfs_file_extent_type(path->nodes[0], ei); in read_symlink()
1491 compression = btrfs_file_extent_compression(path->nodes[0], ei); in read_symlink()
1496 len = btrfs_file_extent_inline_len(path->nodes[0], path->slots[0], ei); in read_symlink()
1498 ret = fs_path_add_from_extent_buffer(dest, path->nodes[0], off, len); in read_symlink()
1501 btrfs_free_path(path); in read_symlink()
1514 struct btrfs_path *path; in gen_unique_name() local
1520 path = alloc_path_for_send(); in gen_unique_name()
1521 if (!path) in gen_unique_name()
1530 path, BTRFS_FIRST_FREE_OBJECTID, in gen_unique_name()
1532 btrfs_release_path(path); in gen_unique_name()
1550 path, BTRFS_FIRST_FREE_OBJECTID, in gen_unique_name()
1552 btrfs_release_path(path); in gen_unique_name()
1569 btrfs_free_path(path); in gen_unique_name()
1677 struct btrfs_path *path; in lookup_dir_item_inode() local
1679 path = alloc_path_for_send(); in lookup_dir_item_inode()
1680 if (!path) in lookup_dir_item_inode()
1683 di = btrfs_lookup_dir_item(NULL, root, path, in lookup_dir_item_inode()
1693 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); in lookup_dir_item_inode()
1699 *found_type = btrfs_dir_type(path->nodes[0], di); in lookup_dir_item_inode()
1702 btrfs_free_path(path); in lookup_dir_item_inode()
1716 struct btrfs_path *path; in get_first_ref() local
1720 path = alloc_path_for_send(); in get_first_ref()
1721 if (!path) in get_first_ref()
1728 ret = btrfs_search_slot_for_read(root, &key, path, 1, 0); in get_first_ref()
1732 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in get_first_ref()
1733 path->slots[0]); in get_first_ref()
1743 iref = btrfs_item_ptr(path->nodes[0], path->slots[0], in get_first_ref()
1745 len = btrfs_inode_ref_name_len(path->nodes[0], iref); in get_first_ref()
1746 ret = fs_path_add_from_extent_buffer(name, path->nodes[0], in get_first_ref()
1752 extref = btrfs_item_ptr(path->nodes[0], path->slots[0], in get_first_ref()
1754 len = btrfs_inode_extref_name_len(path->nodes[0], extref); in get_first_ref()
1755 ret = fs_path_add_from_extent_buffer(name, path->nodes[0], in get_first_ref()
1757 parent_dir = btrfs_inode_extref_parent(path->nodes[0], extref); in get_first_ref()
1761 btrfs_release_path(path); in get_first_ref()
1773 btrfs_free_path(path); in get_first_ref()
2307 struct btrfs_path *path; in send_subvol_begin() local
2314 path = btrfs_alloc_path(); in send_subvol_begin()
2315 if (!path) in send_subvol_begin()
2320 btrfs_free_path(path); in send_subvol_begin()
2329 &key, path, 1, 0); in send_subvol_begin()
2337 leaf = path->nodes[0]; in send_subvol_begin()
2338 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in send_subvol_begin()
2344 ref = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_ref); in send_subvol_begin()
2347 btrfs_release_path(path); in send_subvol_begin()
2385 btrfs_free_path(path); in send_subvol_begin()
2483 struct btrfs_path *path = NULL; in send_utimes() local
2494 path = alloc_path_for_send(); in send_utimes()
2495 if (!path) { in send_utimes()
2503 ret = btrfs_search_slot(NULL, sctx->send_root, &key, path, 0, 0); in send_utimes()
2507 eb = path->nodes[0]; in send_utimes()
2508 slot = path->slots[0]; in send_utimes()
2529 btrfs_free_path(path); in send_utimes()
2625 struct btrfs_path *path = NULL; in did_create_dir() local
2633 path = alloc_path_for_send(); in did_create_dir()
2634 if (!path) { in did_create_dir()
2642 ret = btrfs_search_slot(NULL, sctx->send_root, &key, path, 0, 0); in did_create_dir()
2647 eb = path->nodes[0]; in did_create_dir()
2648 slot = path->slots[0]; in did_create_dir()
2650 ret = btrfs_next_leaf(sctx->send_root, path); in did_create_dir()
2676 path->slots[0]++; in did_create_dir()
2680 btrfs_free_path(path); in did_create_dir()
2729 u64 dir_gen, struct fs_path *path) in __record_ref() argument
2739 ref->full_path = path; in __record_ref()
2794 struct fs_path *path) in orphanize_inode() argument
2807 ret = send_rename(sctx, path, orphan); in orphanize_inode()
2889 struct btrfs_path *path; in can_rmdir() local
2901 path = alloc_path_for_send(); in can_rmdir()
2902 if (!path) in can_rmdir()
2908 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in can_rmdir()
2915 if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { in can_rmdir()
2916 ret = btrfs_next_leaf(root, path); in can_rmdir()
2923 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in can_rmdir()
2924 path->slots[0]); in can_rmdir()
2929 di = btrfs_item_ptr(path->nodes[0], path->slots[0], in can_rmdir()
2931 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &loc); in can_rmdir()
2953 path->slots[0]++; in can_rmdir()
2959 btrfs_free_path(path); in can_rmdir()
3320 struct btrfs_path *path; in wait_for_dest_dir_move() local
3331 path = alloc_path_for_send(); in wait_for_dest_dir_move()
3332 if (!path) in wait_for_dest_dir_move()
3339 ret = btrfs_search_slot(NULL, sctx->parent_root, &key, path, 0, 0); in wait_for_dest_dir_move()
3347 di = btrfs_match_dir_item_name(sctx->parent_root, path, in wait_for_dest_dir_move()
3361 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &di_key); in wait_for_dest_dir_move()
3397 btrfs_free_path(path); in wait_for_dest_dir_move()
3973 struct btrfs_path *path, in find_iref() argument
3986 ret = iterate_inode_ref(root, path, key, 0, __find_iref, &ctx); in find_iref()
4069 struct btrfs_path *path; in process_all_refs() local
4077 path = alloc_path_for_send(); in process_all_refs()
4078 if (!path) in process_all_refs()
4097 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in process_all_refs()
4102 eb = path->nodes[0]; in process_all_refs()
4103 slot = path->slots[0]; in process_all_refs()
4105 ret = btrfs_next_leaf(root, path); in process_all_refs()
4120 ret = iterate_inode_ref(root, path, &found_key, 0, cb, sctx); in process_all_refs()
4124 path->slots[0]++; in process_all_refs()
4126 btrfs_release_path(path); in process_all_refs()
4133 btrfs_free_path(path); in process_all_refs()
4138 struct fs_path *path, in send_set_xattr() argument
4148 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, path); in send_set_xattr()
4160 struct fs_path *path, in send_remove_xattr() argument
4169 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, path); in send_remove_xattr()
4292 struct btrfs_path *path, in find_xattr() argument
4306 ret = iterate_dir_item(root, path, key, __find_xattr, &ctx); in find_xattr()
4390 struct btrfs_path *path; in process_all_new_xattrs() local
4396 path = alloc_path_for_send(); in process_all_new_xattrs()
4397 if (!path) in process_all_new_xattrs()
4405 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in process_all_new_xattrs()
4410 eb = path->nodes[0]; in process_all_new_xattrs()
4411 slot = path->slots[0]; in process_all_new_xattrs()
4413 ret = btrfs_next_leaf(root, path); in process_all_new_xattrs()
4430 ret = iterate_dir_item(root, path, &found_key, in process_all_new_xattrs()
4435 path->slots[0]++; in process_all_new_xattrs()
4439 btrfs_free_path(path); in process_all_new_xattrs()
4732 struct btrfs_path *path; in clone_range() local
4736 path = alloc_path_for_send(); in clone_range()
4737 if (!path) in clone_range()
4765 ret = btrfs_search_slot(NULL, clone_root->root, &key, path, 0, 0); in clone_range()
4768 if (ret > 0 && path->slots[0] > 0) { in clone_range()
4769 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0] - 1); in clone_range()
4772 path->slots[0]--; in clone_range()
4776 struct extent_buffer *leaf = path->nodes[0]; in clone_range()
4777 int slot = path->slots[0]; in clone_range()
4784 ret = btrfs_next_leaf(clone_root->root, path); in clone_range()
4853 path->slots[0]++; in clone_range()
4861 btrfs_free_path(path); in clone_range()
4866 struct btrfs_path *path, in send_write_or_clone() argument
4877 ei = btrfs_item_ptr(path->nodes[0], path->slots[0], in send_write_or_clone()
4879 type = btrfs_file_extent_type(path->nodes[0], ei); in send_write_or_clone()
4881 len = btrfs_file_extent_inline_len(path->nodes[0], in send_write_or_clone()
4882 path->slots[0], ei); in send_write_or_clone()
4890 len = btrfs_file_extent_num_bytes(path->nodes[0], ei); in send_write_or_clone()
4904 disk_byte = btrfs_file_extent_disk_bytenr(path->nodes[0], ei); in send_write_or_clone()
4905 data_offset = btrfs_file_extent_offset(path->nodes[0], ei); in send_write_or_clone()
4921 struct btrfs_path *path = NULL; in is_extent_unchanged() local
4938 path = alloc_path_for_send(); in is_extent_unchanged()
4939 if (!path) in is_extent_unchanged()
4980 ret = btrfs_search_slot_for_read(sctx->parent_root, &key, path, 0, 0); in is_extent_unchanged()
4991 eb = path->nodes[0]; in is_extent_unchanged()
4992 slot = path->slots[0]; in is_extent_unchanged()
5050 ret = btrfs_next_item(sctx->parent_root, path); in is_extent_unchanged()
5054 eb = path->nodes[0]; in is_extent_unchanged()
5055 slot = path->slots[0]; in is_extent_unchanged()
5081 btrfs_free_path(path); in is_extent_unchanged()
5087 struct btrfs_path *path; in get_last_extent() local
5095 path = alloc_path_for_send(); in get_last_extent()
5096 if (!path) in get_last_extent()
5104 ret = btrfs_search_slot_for_read(root, &key, path, 0, 1); in get_last_extent()
5108 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in get_last_extent()
5112 fi = btrfs_item_ptr(path->nodes[0], path->slots[0], in get_last_extent()
5114 type = btrfs_file_extent_type(path->nodes[0], fi); in get_last_extent()
5116 u64 size = btrfs_file_extent_inline_len(path->nodes[0], in get_last_extent()
5117 path->slots[0], fi); in get_last_extent()
5122 btrfs_file_extent_num_bytes(path->nodes[0], fi); in get_last_extent()
5126 btrfs_free_path(path); in get_last_extent()
5130 static int maybe_send_hole(struct send_ctx *sctx, struct btrfs_path *path, in maybe_send_hole() argument
5147 fi = btrfs_item_ptr(path->nodes[0], path->slots[0], in maybe_send_hole()
5149 type = btrfs_file_extent_type(path->nodes[0], fi); in maybe_send_hole()
5151 u64 size = btrfs_file_extent_inline_len(path->nodes[0], in maybe_send_hole()
5152 path->slots[0], fi); in maybe_send_hole()
5157 btrfs_file_extent_num_bytes(path->nodes[0], fi); in maybe_send_hole()
5160 if (path->slots[0] == 0 && in maybe_send_hole()
5181 struct btrfs_path *path, in process_extent() argument
5191 ret = is_extent_unchanged(sctx, path, key); in process_extent()
5202 ei = btrfs_item_ptr(path->nodes[0], path->slots[0], in process_extent()
5204 type = btrfs_file_extent_type(path->nodes[0], ei); in process_extent()
5219 if (btrfs_file_extent_disk_bytenr(path->nodes[0], ei) == 0) { in process_extent()
5226 ret = find_extent_clone(sctx, path, key->objectid, key->offset, in process_extent()
5231 ret = send_write_or_clone(sctx, path, key, found_clone); in process_extent()
5235 ret = maybe_send_hole(sctx, path, key); in process_extent()
5244 struct btrfs_path *path; in process_all_extents() local
5251 path = alloc_path_for_send(); in process_all_extents()
5252 if (!path) in process_all_extents()
5258 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in process_all_extents()
5263 eb = path->nodes[0]; in process_all_extents()
5264 slot = path->slots[0]; in process_all_extents()
5267 ret = btrfs_next_leaf(root, path); in process_all_extents()
5285 ret = process_extent(sctx, path, &found_key); in process_all_extents()
5289 path->slots[0]++; in process_all_extents()
5293 btrfs_free_path(path); in process_all_extents()
5682 static int compare_refs(struct send_ctx *sctx, struct btrfs_path *path, in compare_refs() argument
5702 leaf = path->nodes[0]; in compare_refs()
5703 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in compare_refs()
5704 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in compare_refs()
5787 struct btrfs_path *path; in full_send_tree() local
5791 path = alloc_path_for_send(); in full_send_tree()
5792 if (!path) in full_send_tree()
5799 ret = btrfs_search_slot_for_read(send_root, &key, path, 1, 0); in full_send_tree()
5806 eb = path->nodes[0]; in full_send_tree()
5807 slot = path->slots[0]; in full_send_tree()
5810 ret = changed_cb(send_root, NULL, path, NULL, in full_send_tree()
5819 ret = btrfs_next_item(send_root, path); in full_send_tree()
5832 btrfs_free_path(path); in full_send_tree()