Lines Matching refs:path
115 struct btrfs_path *path; in insert_inline_extent() local
133 path = btrfs_alloc_path(); in insert_inline_extent()
134 if (!path) in insert_inline_extent()
145 ret = btrfs_insert_empty_item(trans, root, path, &key, in insert_inline_extent()
152 leaf = path->nodes[0]; in insert_inline_extent()
153 ei = btrfs_item_ptr(leaf, path->slots[0], in insert_inline_extent()
191 btrfs_free_path(path); in insert_inline_extent()
197 btrfs_free_path(path); in insert_inline_extent()
945 struct btrfs_path *path; in run_delalloc_nocow() local
959 path = btrfs_alloc_path(); in run_delalloc_nocow()
960 BUG_ON(!path); in run_delalloc_nocow()
967 ret = btrfs_lookup_file_extent(trans, root, path, inode->i_ino, in run_delalloc_nocow()
970 if (ret > 0 && path->slots[0] > 0 && check_prev) { in run_delalloc_nocow()
971 leaf = path->nodes[0]; in run_delalloc_nocow()
973 path->slots[0] - 1); in run_delalloc_nocow()
976 path->slots[0]--; in run_delalloc_nocow()
980 leaf = path->nodes[0]; in run_delalloc_nocow()
981 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in run_delalloc_nocow()
982 ret = btrfs_next_leaf(root, path); in run_delalloc_nocow()
987 leaf = path->nodes[0]; in run_delalloc_nocow()
993 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in run_delalloc_nocow()
1005 fi = btrfs_item_ptr(leaf, path->slots[0], in run_delalloc_nocow()
1015 path->slots[0]++; in run_delalloc_nocow()
1051 path->slots[0]++; in run_delalloc_nocow()
1060 path->slots[0]++; in run_delalloc_nocow()
1064 btrfs_release_path(root, path); in run_delalloc_nocow()
1112 btrfs_release_path(root, path); in run_delalloc_nocow()
1124 btrfs_free_path(path); in run_delalloc_nocow()
1447 struct btrfs_path *path; in insert_reserved_file_extent() local
1453 path = btrfs_alloc_path(); in insert_reserved_file_extent()
1454 BUG_ON(!path); in insert_reserved_file_extent()
1463 ret = btrfs_insert_empty_item(trans, root, path, &ins, sizeof(*fi)); in insert_reserved_file_extent()
1465 leaf = path->nodes[0]; in insert_reserved_file_extent()
1466 fi = btrfs_item_ptr(leaf, path->slots[0], in insert_reserved_file_extent()
1491 btrfs_free_path(path); in insert_reserved_file_extent()
1844 struct btrfs_path *path; in btrfs_orphan_cleanup() local
1852 path = btrfs_alloc_path(); in btrfs_orphan_cleanup()
1853 if (!path) in btrfs_orphan_cleanup()
1855 path->reada = -1; in btrfs_orphan_cleanup()
1863 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_orphan_cleanup()
1876 if (path->slots[0] == 0) in btrfs_orphan_cleanup()
1878 path->slots[0]--; in btrfs_orphan_cleanup()
1882 leaf = path->nodes[0]; in btrfs_orphan_cleanup()
1883 item = btrfs_item_nr(leaf, path->slots[0]); in btrfs_orphan_cleanup()
1884 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_orphan_cleanup()
1893 btrfs_release_path(root, path); in btrfs_orphan_cleanup()
1956 btrfs_free_path(path); in btrfs_orphan_cleanup()
1964 struct btrfs_path *path; in btrfs_read_locked_inode() local
1974 path = btrfs_alloc_path(); in btrfs_read_locked_inode()
1975 BUG_ON(!path); in btrfs_read_locked_inode()
1978 ret = btrfs_lookup_inode(NULL, root, path, &location, 0); in btrfs_read_locked_inode()
1982 leaf = path->nodes[0]; in btrfs_read_locked_inode()
1983 inode_item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_read_locked_inode()
2018 btrfs_free_path(path); in btrfs_read_locked_inode()
2049 btrfs_free_path(path); in btrfs_read_locked_inode()
2098 struct btrfs_path *path; in btrfs_update_inode() local
2102 path = btrfs_alloc_path(); in btrfs_update_inode()
2103 BUG_ON(!path); in btrfs_update_inode()
2104 ret = btrfs_lookup_inode(trans, root, path, in btrfs_update_inode()
2112 btrfs_unlock_up_safe(path, 1); in btrfs_update_inode()
2113 leaf = path->nodes[0]; in btrfs_update_inode()
2114 inode_item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_update_inode()
2122 btrfs_free_path(path); in btrfs_update_inode()
2137 struct btrfs_path *path; in btrfs_unlink_inode() local
2144 path = btrfs_alloc_path(); in btrfs_unlink_inode()
2145 if (!path) { in btrfs_unlink_inode()
2150 di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino, in btrfs_unlink_inode()
2160 leaf = path->nodes[0]; in btrfs_unlink_inode()
2162 ret = btrfs_delete_one_dir_name(trans, root, path, di); in btrfs_unlink_inode()
2165 btrfs_release_path(root, path); in btrfs_unlink_inode()
2177 di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino, in btrfs_unlink_inode()
2187 ret = btrfs_delete_one_dir_name(trans, root, path, di); in btrfs_unlink_inode()
2188 btrfs_release_path(root, path); in btrfs_unlink_inode()
2200 btrfs_free_path(path); in btrfs_unlink_inode()
2302 struct btrfs_path *path,
2314 path->lowest_level = 1;
2319 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
2323 if (path->nodes[1] == NULL) {
2328 btrfs_node_key_to_cpu(path->nodes[1], &found_key, path->slots[1]);
2329 nritems = btrfs_header_nritems(path->nodes[1]);
2334 if (path->slots[1] >= nritems)
2346 if (path->slots[1] + 1 >= nritems) {
2351 btrfs_node_key_to_cpu(path->nodes[1], &found_key, nritems - 1);
2363 btrfs_release_path(root, path);
2371 path->keep_locks = 1;
2373 path, 0, 0);
2374 path->keep_locks = 0;
2382 btrfs_release_path(root, path);
2390 btrfs_node_key_to_cpu(path->nodes[1], &other_key, path->slots[1] + 1);
2406 leaf_start = btrfs_node_blockptr(path->nodes[1], path->slots[1]);
2407 leaf_gen = btrfs_node_ptr_generation(path->nodes[1], path->slots[1]);
2412 ret = btrfs_del_leaf(trans, root, path, leaf_start);
2434 btrfs_release_path(root, path);
2445 path->lowest_level = 0;
2446 path->keep_locks = 0;
2447 btrfs_release_path(root, path);
2470 struct btrfs_path *path; in btrfs_truncate_inode_items() local
2491 path = btrfs_alloc_path(); in btrfs_truncate_inode_items()
2492 path->reada = -1; in btrfs_truncate_inode_items()
2493 BUG_ON(!path); in btrfs_truncate_inode_items()
2501 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_truncate_inode_items()
2509 if (path->slots[0] == 0) { in btrfs_truncate_inode_items()
2513 path->slots[0]--; in btrfs_truncate_inode_items()
2518 leaf = path->nodes[0]; in btrfs_truncate_inode_items()
2519 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_truncate_inode_items()
2531 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_truncate_inode_items()
2621 ret = btrfs_truncate_item(trans, root, path, in btrfs_truncate_inode_items()
2633 pending_del_slot = path->slots[0]; in btrfs_truncate_inode_items()
2636 path->slots[0] + 1 == pending_del_slot) { in btrfs_truncate_inode_items()
2639 pending_del_slot = path->slots[0]; in btrfs_truncate_inode_items()
2654 if (path->slots[0] == 0) { in btrfs_truncate_inode_items()
2657 btrfs_release_path(root, path); in btrfs_truncate_inode_items()
2663 path->slots[0]--; in btrfs_truncate_inode_items()
2665 path->slots[0] + 1 != pending_del_slot) { in btrfs_truncate_inode_items()
2668 btrfs_item_key_to_cpu(path->nodes[0], &debug, in btrfs_truncate_inode_items()
2670 ret = btrfs_del_items(trans, root, path, in btrfs_truncate_inode_items()
2675 btrfs_release_path(root, path); in btrfs_truncate_inode_items()
2684 ret = btrfs_del_items(trans, root, path, pending_del_slot, in btrfs_truncate_inode_items()
2687 btrfs_free_path(path); in btrfs_truncate_inode_items()
2916 struct btrfs_path *path; in btrfs_inode_by_name() local
2920 path = btrfs_alloc_path(); in btrfs_inode_by_name()
2921 BUG_ON(!path); in btrfs_inode_by_name()
2923 di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name, in btrfs_inode_by_name()
2931 btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); in btrfs_inode_by_name()
2933 btrfs_free_path(path); in btrfs_inode_by_name()
3135 struct btrfs_path *path; in btrfs_real_readdir() local
3173 path = btrfs_alloc_path(); in btrfs_real_readdir()
3174 path->reada = 2; in btrfs_real_readdir()
3180 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_real_readdir()
3186 leaf = path->nodes[0]; in btrfs_real_readdir()
3188 slot = path->slots[0]; in btrfs_real_readdir()
3191 ret = btrfs_next_leaf(root, path); in btrfs_real_readdir()
3194 leaf = path->nodes[0]; in btrfs_real_readdir()
3196 slot = path->slots[0]; in btrfs_real_readdir()
3199 path->slots[0]++; in btrfs_real_readdir()
3272 btrfs_free_path(path); in btrfs_real_readdir()
3319 struct btrfs_path *path; in btrfs_set_inode_index_count() local
3327 path = btrfs_alloc_path(); in btrfs_set_inode_index_count()
3328 if (!path) in btrfs_set_inode_index_count()
3331 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_set_inode_index_count()
3345 if (path->slots[0] == 0) { in btrfs_set_inode_index_count()
3350 path->slots[0]--; in btrfs_set_inode_index_count()
3352 leaf = path->nodes[0]; in btrfs_set_inode_index_count()
3353 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_set_inode_index_count()
3363 btrfs_free_path(path); in btrfs_set_inode_index_count()
3397 struct btrfs_path *path; in btrfs_new_inode() local
3405 path = btrfs_alloc_path(); in btrfs_new_inode()
3406 BUG_ON(!path); in btrfs_new_inode()
3452 ret = btrfs_insert_empty_items(trans, root, path, key, sizes, 2); in btrfs_new_inode()
3472 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_new_inode()
3474 fill_inode_item(trans, path->nodes[0], inode_item, inode); in btrfs_new_inode()
3476 ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1, in btrfs_new_inode()
3478 btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len); in btrfs_new_inode()
3479 btrfs_set_inode_ref_index(path->nodes[0], ref, *index); in btrfs_new_inode()
3481 write_extent_buffer(path->nodes[0], name, ptr, name_len); in btrfs_new_inode()
3483 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_new_inode()
3484 btrfs_free_path(path); in btrfs_new_inode()
3496 btrfs_free_path(path); in btrfs_new_inode()
3840 static noinline int uncompress_inline(struct btrfs_path *path, in uncompress_inline() argument
3846 struct extent_buffer *leaf = path->nodes[0]; in uncompress_inline()
3855 btrfs_item_nr(leaf, path->slots[0])); in uncompress_inline()
3896 struct btrfs_path *path = NULL; in btrfs_get_extent() local
3933 if (!path) { in btrfs_get_extent()
3934 path = btrfs_alloc_path(); in btrfs_get_extent()
3935 BUG_ON(!path); in btrfs_get_extent()
3938 ret = btrfs_lookup_file_extent(trans, root, path, in btrfs_get_extent()
3946 if (path->slots[0] == 0) in btrfs_get_extent()
3948 path->slots[0]--; in btrfs_get_extent()
3951 leaf = path->nodes[0]; in btrfs_get_extent()
3952 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_get_extent()
3955 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_get_extent()
3977 path->slots[0]++; in btrfs_get_extent()
3978 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_get_extent()
3979 ret = btrfs_next_leaf(root, path); in btrfs_get_extent()
3986 leaf = path->nodes[0]; in btrfs_get_extent()
3988 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_get_extent()
4051 ret = uncompress_inline(path, inode, page, in btrfs_get_extent()
4067 btrfs_release_path(root, path); in btrfs_get_extent()
4091 btrfs_release_path(root, path); in btrfs_get_extent()
4145 if (path) in btrfs_get_extent()
4146 btrfs_free_path(path); in btrfs_get_extent()
4704 struct btrfs_path *path; in btrfs_symlink() local
4767 path = btrfs_alloc_path(); in btrfs_symlink()
4768 BUG_ON(!path); in btrfs_symlink()
4773 err = btrfs_insert_empty_item(trans, root, path, &key, in btrfs_symlink()
4779 leaf = path->nodes[0]; in btrfs_symlink()
4780 ei = btrfs_item_ptr(leaf, path->slots[0], in btrfs_symlink()
4793 btrfs_free_path(path); in btrfs_symlink()