Lines Matching refs:path

137 				struct btrfs_path *path, int extent_inserted,  in insert_inline_extent()  argument
167 path->leave_spinning = 1; in insert_inline_extent()
168 ret = btrfs_insert_empty_item(trans, root, path, &key, in insert_inline_extent()
175 leaf = path->nodes[0]; in insert_inline_extent()
176 ei = btrfs_item_ptr(leaf, path->slots[0], in insert_inline_extent()
214 btrfs_release_path(path); in insert_inline_extent()
252 struct btrfs_path *path; in cow_file_range_inline() local
269 path = btrfs_alloc_path(); in cow_file_range_inline()
270 if (!path) in cow_file_range_inline()
275 btrfs_free_path(path); in cow_file_range_inline()
287 ret = __btrfs_drop_extents(trans, root, inode, path, in cow_file_range_inline()
297 ret = insert_inline_extent(trans, path, extent_inserted, in cow_file_range_inline()
320 btrfs_free_path(path); in cow_file_range_inline()
1223 struct btrfs_path *path; in run_delalloc_nocow() local
1242 path = btrfs_alloc_path(); in run_delalloc_nocow()
1243 if (!path) { in run_delalloc_nocow()
1269 btrfs_free_path(path); in run_delalloc_nocow()
1278 ret = btrfs_lookup_file_extent(trans, root, path, ino, in run_delalloc_nocow()
1282 if (ret > 0 && path->slots[0] > 0 && check_prev) { in run_delalloc_nocow()
1283 leaf = path->nodes[0]; in run_delalloc_nocow()
1285 path->slots[0] - 1); in run_delalloc_nocow()
1288 path->slots[0]--; in run_delalloc_nocow()
1292 leaf = path->nodes[0]; in run_delalloc_nocow()
1293 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in run_delalloc_nocow()
1294 ret = btrfs_next_leaf(root, path); in run_delalloc_nocow()
1299 leaf = path->nodes[0]; in run_delalloc_nocow()
1305 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in run_delalloc_nocow()
1311 path->slots[0]++; in run_delalloc_nocow()
1324 fi = btrfs_item_ptr(leaf, path->slots[0], in run_delalloc_nocow()
1338 path->slots[0]++; in run_delalloc_nocow()
1378 path->slots[0], fi); in run_delalloc_nocow()
1385 path->slots[0]++; in run_delalloc_nocow()
1396 path->slots[0]++; in run_delalloc_nocow()
1400 btrfs_release_path(path); in run_delalloc_nocow()
1474 btrfs_release_path(path); in run_delalloc_nocow()
1501 btrfs_free_path(path); in run_delalloc_nocow()
2076 struct btrfs_path *path; in insert_reserved_file_extent() local
2082 path = btrfs_alloc_path(); in insert_reserved_file_extent()
2083 if (!path) in insert_reserved_file_extent()
2095 ret = __btrfs_drop_extents(trans, root, inode, path, file_pos, in insert_reserved_file_extent()
2106 path->leave_spinning = 1; in insert_reserved_file_extent()
2107 ret = btrfs_insert_empty_item(trans, root, path, &ins, in insert_reserved_file_extent()
2112 leaf = path->nodes[0]; in insert_reserved_file_extent()
2113 fi = btrfs_item_ptr(leaf, path->slots[0], in insert_reserved_file_extent()
2127 btrfs_release_path(path); in insert_reserved_file_extent()
2144 btrfs_free_path(path); in insert_reserved_file_extent()
2175 struct btrfs_path *path; member
2250 struct btrfs_path *path = new->path; in record_one_backref() local
2287 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in record_one_backref()
2295 leaf = path->nodes[0]; in record_one_backref()
2296 slot = path->slots[0]; in record_one_backref()
2299 ret = btrfs_next_leaf(root, path); in record_one_backref()
2309 path->slots[0]++; in record_one_backref()
2359 btrfs_release_path(path); in record_one_backref()
2364 static noinline bool record_extent_backrefs(struct btrfs_path *path, in record_extent_backrefs() argument
2371 new->path = path; in record_extent_backrefs()
2376 path, record_one_backref, in record_extent_backrefs()
2417 static noinline int relink_extent_backref(struct btrfs_path *path, in relink_extent_backref() argument
2503 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in relink_extent_backref()
2511 extent = btrfs_item_ptr(path->nodes[0], path->slots[0], in relink_extent_backref()
2514 if (btrfs_file_extent_generation(path->nodes[0], extent) != in relink_extent_backref()
2518 btrfs_release_path(path); in relink_extent_backref()
2538 path->leave_spinning = 1; in relink_extent_backref()
2544 ret = btrfs_search_slot(trans, root, &key, path, 0, 1); in relink_extent_backref()
2548 path->slots[0]--; in relink_extent_backref()
2549 leaf = path->nodes[0]; in relink_extent_backref()
2550 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in relink_extent_backref()
2552 fi = btrfs_item_ptr(leaf, path->slots[0], in relink_extent_backref()
2567 btrfs_release_path(path); in relink_extent_backref()
2572 ret = btrfs_insert_empty_item(trans, root, path, &key, in relink_extent_backref()
2579 leaf = path->nodes[0]; in relink_extent_backref()
2580 item = btrfs_item_ptr(leaf, path->slots[0], in relink_extent_backref()
2595 btrfs_release_path(path); in relink_extent_backref()
2608 btrfs_release_path(path); in relink_extent_backref()
2609 path->leave_spinning = 0; in relink_extent_backref()
2633 struct btrfs_path *path; in relink_file_extents() local
2644 path = btrfs_alloc_path(); in relink_file_extents()
2645 if (!path) in relink_file_extents()
2648 if (!record_extent_backrefs(path, new)) { in relink_file_extents()
2649 btrfs_free_path(path); in relink_file_extents()
2652 btrfs_release_path(path); in relink_file_extents()
2662 ret = relink_extent_backref(path, prev, backref); in relink_file_extents()
2675 btrfs_free_path(path); in relink_file_extents()
2688 struct btrfs_path *path; in record_old_file_extents() local
2707 path = btrfs_alloc_path(); in record_old_file_extents()
2708 if (!path) in record_old_file_extents()
2715 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in record_old_file_extents()
2718 if (ret > 0 && path->slots[0] > 0) in record_old_file_extents()
2719 path->slots[0]--; in record_old_file_extents()
2732 l = path->nodes[0]; in record_old_file_extents()
2733 slot = path->slots[0]; in record_old_file_extents()
2736 ret = btrfs_next_leaf(root, path); in record_old_file_extents()
2780 path->slots[0]++; in record_old_file_extents()
2784 btrfs_free_path(path); in record_old_file_extents()
2790 btrfs_free_path(path); in record_old_file_extents()
3334 struct btrfs_path *path; in btrfs_orphan_cleanup() local
3345 path = btrfs_alloc_path(); in btrfs_orphan_cleanup()
3346 if (!path) { in btrfs_orphan_cleanup()
3350 path->reada = -1; in btrfs_orphan_cleanup()
3357 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_orphan_cleanup()
3368 if (path->slots[0] == 0) in btrfs_orphan_cleanup()
3370 path->slots[0]--; in btrfs_orphan_cleanup()
3374 leaf = path->nodes[0]; in btrfs_orphan_cleanup()
3375 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_orphan_cleanup()
3384 btrfs_release_path(path); in btrfs_orphan_cleanup()
3504 btrfs_release_path(path); in btrfs_orphan_cleanup()
3528 btrfs_free_path(path); in btrfs_orphan_cleanup()
3606 struct btrfs_path *path; in btrfs_read_locked_inode() local
3622 path = btrfs_alloc_path(); in btrfs_read_locked_inode()
3623 if (!path) in btrfs_read_locked_inode()
3628 ret = btrfs_lookup_inode(NULL, root, path, &location, 0); in btrfs_read_locked_inode()
3632 leaf = path->nodes[0]; in btrfs_read_locked_inode()
3637 inode_item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_read_locked_inode()
3714 path->slots[0]++; in btrfs_read_locked_inode()
3716 path->slots[0] >= btrfs_header_nritems(leaf)) in btrfs_read_locked_inode()
3719 btrfs_item_key_to_cpu(leaf, &location, path->slots[0]); in btrfs_read_locked_inode()
3723 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in btrfs_read_locked_inode()
3741 maybe_acls = acls_after_inode_item(leaf, path->slots[0], in btrfs_read_locked_inode()
3744 path->slots[0] = first_xattr_slot; in btrfs_read_locked_inode()
3745 ret = btrfs_load_inode_props(inode, path); in btrfs_read_locked_inode()
3752 btrfs_free_path(path); in btrfs_read_locked_inode()
3785 btrfs_free_path(path); in btrfs_read_locked_inode()
3846 struct btrfs_path *path; in btrfs_update_inode_item() local
3850 path = btrfs_alloc_path(); in btrfs_update_inode_item()
3851 if (!path) in btrfs_update_inode_item()
3854 path->leave_spinning = 1; in btrfs_update_inode_item()
3855 ret = btrfs_lookup_inode(trans, root, path, &BTRFS_I(inode)->location, in btrfs_update_inode_item()
3863 leaf = path->nodes[0]; in btrfs_update_inode_item()
3864 inode_item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_update_inode_item()
3872 btrfs_free_path(path); in btrfs_update_inode_item()
3927 struct btrfs_path *path; in __btrfs_unlink_inode() local
3936 path = btrfs_alloc_path(); in __btrfs_unlink_inode()
3937 if (!path) { in __btrfs_unlink_inode()
3942 path->leave_spinning = 1; in __btrfs_unlink_inode()
3943 di = btrfs_lookup_dir_item(trans, root, path, dir_ino, in __btrfs_unlink_inode()
3953 leaf = path->nodes[0]; in __btrfs_unlink_inode()
3955 ret = btrfs_delete_one_dir_name(trans, root, path, di); in __btrfs_unlink_inode()
3958 btrfs_release_path(path); in __btrfs_unlink_inode()
4008 btrfs_free_path(path); in __btrfs_unlink_inode()
4092 struct btrfs_path *path; in btrfs_unlink_subvol() local
4100 path = btrfs_alloc_path(); in btrfs_unlink_subvol()
4101 if (!path) in btrfs_unlink_subvol()
4104 di = btrfs_lookup_dir_item(trans, root, path, dir_ino, in btrfs_unlink_subvol()
4114 leaf = path->nodes[0]; in btrfs_unlink_subvol()
4117 ret = btrfs_delete_one_dir_name(trans, root, path, di); in btrfs_unlink_subvol()
4122 btrfs_release_path(path); in btrfs_unlink_subvol()
4132 di = btrfs_search_dir_index_item(root, path, dir_ino, in btrfs_unlink_subvol()
4143 leaf = path->nodes[0]; in btrfs_unlink_subvol()
4144 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_unlink_subvol()
4145 btrfs_release_path(path); in btrfs_unlink_subvol()
4148 btrfs_release_path(path); in btrfs_unlink_subvol()
4163 btrfs_free_path(path); in btrfs_unlink_subvol()
4223 struct btrfs_path *path, in truncate_inline_extent() argument
4228 struct extent_buffer *leaf = path->nodes[0]; in truncate_inline_extent()
4229 int slot = path->slots[0]; in truncate_inline_extent()
4249 btrfs_release_path(path); in truncate_inline_extent()
4255 btrfs_truncate_item(root, path, size, 1); in truncate_inline_extent()
4279 struct btrfs_path *path; in btrfs_truncate_inode_items() local
4313 path = btrfs_alloc_path(); in btrfs_truncate_inode_items()
4314 if (!path) in btrfs_truncate_inode_items()
4316 path->reada = -1; in btrfs_truncate_inode_items()
4355 path->leave_spinning = 1; in btrfs_truncate_inode_items()
4356 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_truncate_inode_items()
4366 if (path->slots[0] == 0) in btrfs_truncate_inode_items()
4368 path->slots[0]--; in btrfs_truncate_inode_items()
4373 leaf = path->nodes[0]; in btrfs_truncate_inode_items()
4374 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_truncate_inode_items()
4385 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_truncate_inode_items()
4393 path->slots[0], fi); in btrfs_truncate_inode_items()
4467 err = btrfs_del_items(trans, root, path, in btrfs_truncate_inode_items()
4479 err = truncate_inline_extent(inode, path, in btrfs_truncate_inode_items()
4497 pending_del_slot = path->slots[0]; in btrfs_truncate_inode_items()
4500 path->slots[0] + 1 == pending_del_slot) { in btrfs_truncate_inode_items()
4503 pending_del_slot = path->slots[0]; in btrfs_truncate_inode_items()
4515 btrfs_set_path_blocking(path); in btrfs_truncate_inode_items()
4540 if (path->slots[0] == 0 || in btrfs_truncate_inode_items()
4541 path->slots[0] != pending_del_slot || in btrfs_truncate_inode_items()
4544 ret = btrfs_del_items(trans, root, path, in btrfs_truncate_inode_items()
4554 btrfs_release_path(path); in btrfs_truncate_inode_items()
4574 path->slots[0]--; in btrfs_truncate_inode_items()
4579 ret = btrfs_del_items(trans, root, path, pending_del_slot, in btrfs_truncate_inode_items()
4588 btrfs_free_path(path); in btrfs_truncate_inode_items()
5316 struct btrfs_path *path; in btrfs_inode_by_name() local
5320 path = btrfs_alloc_path(); in btrfs_inode_by_name()
5321 if (!path) in btrfs_inode_by_name()
5324 di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir), name, in btrfs_inode_by_name()
5332 btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); in btrfs_inode_by_name()
5334 btrfs_free_path(path); in btrfs_inode_by_name()
5352 struct btrfs_path *path; in fixup_tree_root_location() local
5360 path = btrfs_alloc_path(); in fixup_tree_root_location()
5361 if (!path) { in fixup_tree_root_location()
5371 ret = btrfs_search_slot(NULL, root->fs_info->tree_root, &key, path, in fixup_tree_root_location()
5379 leaf = path->nodes[0]; in fixup_tree_root_location()
5380 ref = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_ref); in fixup_tree_root_location()
5391 btrfs_release_path(path); in fixup_tree_root_location()
5405 btrfs_free_path(path); in fixup_tree_root_location()
5724 struct btrfs_path *path; in btrfs_real_readdir() local
5749 path = btrfs_alloc_path(); in btrfs_real_readdir()
5750 if (!path) in btrfs_real_readdir()
5753 path->reada = 1; in btrfs_real_readdir()
5765 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_real_readdir()
5771 leaf = path->nodes[0]; in btrfs_real_readdir()
5772 slot = path->slots[0]; in btrfs_real_readdir()
5774 ret = btrfs_next_leaf(root, path); in btrfs_real_readdir()
5856 path->slots[0]++; in btrfs_real_readdir()
5907 btrfs_free_path(path); in btrfs_real_readdir()
6004 struct btrfs_path *path; in btrfs_set_inode_index_count() local
6012 path = btrfs_alloc_path(); in btrfs_set_inode_index_count()
6013 if (!path) in btrfs_set_inode_index_count()
6016 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_set_inode_index_count()
6030 if (path->slots[0] == 0) { in btrfs_set_inode_index_count()
6035 path->slots[0]--; in btrfs_set_inode_index_count()
6037 leaf = path->nodes[0]; in btrfs_set_inode_index_count()
6038 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_set_inode_index_count()
6048 btrfs_free_path(path); in btrfs_set_inode_index_count()
6096 struct btrfs_path *path; in btrfs_new_inode() local
6104 path = btrfs_alloc_path(); in btrfs_new_inode()
6105 if (!path) in btrfs_new_inode()
6110 btrfs_free_path(path); in btrfs_new_inode()
6132 btrfs_free_path(path); in btrfs_new_inode()
6187 path->leave_spinning = 1; in btrfs_new_inode()
6188 ret = btrfs_insert_empty_items(trans, root, path, key, sizes, nitems); in btrfs_new_inode()
6200 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_new_inode()
6202 memset_extent_buffer(path->nodes[0], 0, (unsigned long)inode_item, in btrfs_new_inode()
6204 fill_inode_item(trans, path->nodes[0], inode_item, inode); in btrfs_new_inode()
6207 ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1, in btrfs_new_inode()
6209 btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len); in btrfs_new_inode()
6210 btrfs_set_inode_ref_index(path->nodes[0], ref, *index); in btrfs_new_inode()
6212 write_extent_buffer(path->nodes[0], name, ptr, name_len); in btrfs_new_inode()
6215 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_new_inode()
6216 btrfs_free_path(path); in btrfs_new_inode()
6248 btrfs_free_path(path); in btrfs_new_inode()
6699 static noinline int uncompress_inline(struct btrfs_path *path, in uncompress_inline() argument
6705 struct extent_buffer *leaf = path->nodes[0]; in uncompress_inline()
6716 btrfs_item_nr(path->slots[0])); in uncompress_inline()
6750 struct btrfs_path *path = NULL; in btrfs_get_extent() local
6787 if (!path) { in btrfs_get_extent()
6788 path = btrfs_alloc_path(); in btrfs_get_extent()
6789 if (!path) { in btrfs_get_extent()
6797 path->reada = 1; in btrfs_get_extent()
6800 ret = btrfs_lookup_file_extent(trans, root, path, in btrfs_get_extent()
6808 if (path->slots[0] == 0) in btrfs_get_extent()
6810 path->slots[0]--; in btrfs_get_extent()
6813 leaf = path->nodes[0]; in btrfs_get_extent()
6814 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_get_extent()
6817 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_get_extent()
6839 size = btrfs_file_extent_inline_len(leaf, path->slots[0], item); in btrfs_get_extent()
6844 path->slots[0]++; in btrfs_get_extent()
6845 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_get_extent()
6846 ret = btrfs_next_leaf(root, path); in btrfs_get_extent()
6853 leaf = path->nodes[0]; in btrfs_get_extent()
6855 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_get_extent()
6869 btrfs_extent_item_to_extent_map(inode, path, item, new_inline, em); in btrfs_get_extent()
6884 size = btrfs_file_extent_inline_len(leaf, path->slots[0], item); in btrfs_get_extent()
6896 ret = uncompress_inline(path, inode, page, in btrfs_get_extent()
6922 btrfs_release_path(path); in btrfs_get_extent()
6947 btrfs_release_path(path); in btrfs_get_extent()
6996 btrfs_free_path(path); in btrfs_get_extent()
7179 struct btrfs_path *path; in can_nocow_extent() local
7194 path = btrfs_alloc_path(); in can_nocow_extent()
7195 if (!path) in can_nocow_extent()
7198 ret = btrfs_lookup_file_extent(NULL, root, path, btrfs_ino(inode), in can_nocow_extent()
7203 slot = path->slots[0]; in can_nocow_extent()
7213 leaf = path->nodes[0]; in can_nocow_extent()
7274 btrfs_release_path(path); in can_nocow_extent()
7311 btrfs_free_path(path); in can_nocow_extent()
9644 struct btrfs_path *path; in btrfs_symlink() local
9703 path = btrfs_alloc_path(); in btrfs_symlink()
9704 if (!path) { in btrfs_symlink()
9712 err = btrfs_insert_empty_item(trans, root, path, &key, in btrfs_symlink()
9715 btrfs_free_path(path); in btrfs_symlink()
9718 leaf = path->nodes[0]; in btrfs_symlink()
9719 ei = btrfs_item_ptr(leaf, path->slots[0], in btrfs_symlink()
9732 btrfs_free_path(path); in btrfs_symlink()