Lines Matching defs:path
109 struct btrfs_path path;
158 /* This makes the path point to (inum INODE_ITEM ioff). */
163 ret = btrfs_search_slot(NULL, local_root, &key, &warn->path, 0, 0);
166 btrfs_release_path(&warn->path);
170 eb = warn->path.nodes[0];
171 inode_item = btrfs_item_ptr(eb, warn->path.slots[0], struct btrfs_inode_item);
173 btrfs_release_path(&warn->path);
176 ipath = init_ipath(4096, local_root, &warn->path);
201 "checksum error at logical %llu mirror %u root %llu inode %llu offset %llu length %u links %u (path: %s)",
213 "checksum error at logical %llu mirror %u root %llu inode %llu offset %llu, path resolving failed with ret=%d",
231 struct btrfs_path path = { 0 };
265 ret = extent_from_logical(fs_info, logical, &path, &found_key, &flags);
271 eb = path.nodes[0];
272 ei = btrfs_item_ptr(eb, path.slots[0], struct btrfs_extent_item);
273 item_size = btrfs_item_size(eb, path.slots[0]);
298 btrfs_release_path(&path);
303 btrfs_release_path(&path);
503 struct btrfs_path *path,
535 ret = btrfs_insert_empty_item(trans, root, path, &key,
540 leaf = path->nodes[0];
541 ei = btrfs_item_ptr(leaf, path->slots[0],
577 btrfs_release_path(path);
624 struct btrfs_path *path;
638 path = btrfs_alloc_path();
639 if (!path)
644 btrfs_free_path(path);
649 drop_args.path = path;
661 ret = insert_inline_extent(trans, path, inode, drop_args.extent_inserted,
691 btrfs_free_path(path);
1138 * path for ENOSPC. But we can't reserve space even for
1141 * path.
1360 * extents follows a NOCOW path because relocation preallocates the
1777 * that if the COW path fails for any reason, it decrements (through
1828 * Free the path passed to can_nocow_file_extent() once it's not needed
1843 * Check if we can NOCOW the file extent that the path points to.
1844 * This function may return with the path released, so the caller should check
1845 * if path->nodes[0] is NULL or not if it needs to use the path afterwards.
1851 static int can_nocow_file_extent(struct btrfs_path *path,
1857 struct extent_buffer *leaf = path->nodes[0];
1864 bool nowait = path->nowait;
1866 fi = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
1901 extent_end = btrfs_file_extent_end(path);
1905 * locks and do btree or rbtree searches, so release the path to avoid
1908 btrfs_release_path(path);
1912 args->disk_bytenr, args->strict, path);
1919 * We don't need the path anymore, plus through the
1921 * another path. So free the path to avoid unnecessary extra
1924 btrfs_free_path(path);
1925 path = NULL;
1949 if (args->free_path && path)
1950 btrfs_free_path(path);
1968 struct btrfs_path *path;
1983 path = btrfs_alloc_path();
1984 if (!path) {
2004 ret = btrfs_lookup_file_extent(NULL, root, path, ino,
2014 if (ret > 0 && path->slots[0] > 0 && check_prev) {
2015 leaf = path->nodes[0];
2017 path->slots[0] - 1);
2020 path->slots[0]--;
2025 leaf = path->nodes[0];
2026 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
2027 ret = btrfs_next_leaf(root, path);
2032 leaf = path->nodes[0];
2035 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
2046 path->slots[0]++;
2069 fi = btrfs_item_ptr(leaf, path->slots[0],
2079 extent_end = btrfs_file_extent_end(path);
2086 path->slots[0]++;
2091 ret = can_nocow_file_extent(path, &found_key, inode, &nocow_args);
2113 if (!path->nodes[0])
2115 path->slots[0]++;
2199 btrfs_release_path(path);
2212 btrfs_free_path(path);
2230 btrfs_free_path(path);
2866 struct btrfs_path *path;
2877 path = btrfs_alloc_path();
2878 if (!path)
2890 drop_args.path = path;
2904 ret = btrfs_insert_empty_item(trans, root, path, &ins,
2909 leaf = path->nodes[0];
2912 btrfs_item_ptr_offset(leaf, path->slots[0]),
2916 btrfs_release_path(path);
2949 btrfs_free_path(path);
3457 struct btrfs_path *path;
3468 path = btrfs_alloc_path();
3469 if (!path) {
3473 path->reada = READA_BACK;
3480 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
3486 * is weird, but possible, so only screw with path if we didn't
3491 if (path->slots[0] == 0)
3493 path->slots[0]--;
3497 leaf = path->nodes[0];
3498 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
3506 /* release the path since we're done with it */
3507 btrfs_release_path(path);
3631 /* release the path since we're done with it */
3632 btrfs_release_path(path);
3646 btrfs_free_path(path);
3726 struct btrfs_path *path = in_path;
3742 if (!path) {
3743 path = btrfs_alloc_path();
3744 if (!path)
3750 ret = btrfs_lookup_inode(NULL, root, path, &location, 0);
3752 if (path != in_path)
3753 btrfs_free_path(path);
3757 leaf = path->nodes[0];
3762 inode_item = btrfs_item_ptr(leaf, path->slots[0],
3851 path->slots[0]++;
3853 path->slots[0] >= btrfs_header_nritems(leaf))
3856 btrfs_item_key_to_cpu(leaf, &location, path->slots[0]);
3860 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
3878 maybe_acls = acls_after_inode_item(leaf, path->slots[0],
3881 path->slots[0] = first_xattr_slot;
3882 ret = btrfs_load_inode_props(inode, path);
3889 if (path != in_path)
3890 btrfs_free_path(path);
3979 struct btrfs_path *path;
3983 path = btrfs_alloc_path();
3984 if (!path)
3987 ret = btrfs_lookup_inode(trans, root, path, &inode->location, 1);
3994 leaf = path->nodes[0];
3995 inode_item = btrfs_item_ptr(leaf, path->slots[0],
4003 btrfs_free_path(path);
4062 struct btrfs_path *path;
4069 path = btrfs_alloc_path();
4070 if (!path) {
4075 di = btrfs_lookup_dir_item(trans, root, path, dir_ino, name, -1);
4080 ret = btrfs_delete_one_dir_name(trans, root, path, di);
4083 btrfs_release_path(path);
4143 btrfs_free_path(path);
4233 struct btrfs_path *path;
4259 path = btrfs_alloc_path();
4260 if (!path) {
4265 di = btrfs_lookup_dir_item(trans, root, path, dir_ino,
4272 leaf = path->nodes[0];
4275 ret = btrfs_delete_one_dir_name(trans, root, path, di);
4280 btrfs_release_path(path);
4292 di = btrfs_search_dir_index_item(root, path, dir_ino, &fname.disk_name);
4302 leaf = path->nodes[0];
4303 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
4305 btrfs_release_path(path);
4329 btrfs_free_path(path);
4341 struct btrfs_path *path;
4348 path = btrfs_alloc_path();
4349 if (!path)
4354 di = btrfs_lookup_dir_item(NULL, fs_info->tree_root, path,
4357 btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
4365 btrfs_release_path(path);
4372 ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0);
4378 if (path->slots[0] > 0) {
4379 path->slots[0]--;
4380 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
4386 btrfs_free_path(path);
5340 struct btrfs_path *path;
5345 path = btrfs_alloc_path();
5346 if (!path)
5360 di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir),
5367 btrfs_dir_item_key_to_cpu(path->nodes[0], di, location);
5377 *type = btrfs_dir_ftype(path->nodes[0], di);
5380 btrfs_free_path(path);
5395 struct btrfs_path *path;
5408 path = btrfs_alloc_path();
5409 if (!path) {
5419 ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0);
5426 leaf = path->nodes[0];
5427 ref = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_ref);
5437 btrfs_release_path(path);
5451 btrfs_free_path(path);
5564 struct btrfs_root *root, struct btrfs_path *path)
5575 ret = btrfs_read_locked_inode(inode, path);
5743 struct btrfs_path *path;
5751 path = btrfs_alloc_path();
5752 if (!path)
5755 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5763 if (path->slots[0] == 0) {
5768 path->slots[0]--;
5770 leaf = path->nodes[0];
5771 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
5781 btrfs_free_path(path);
5885 struct btrfs_path *path;
5900 path = btrfs_alloc_path();
5901 if (!path)
5905 path->reada = READA_FORWARD;
5915 btrfs_for_each_slot(root, &key, &found_key, path, ret) {
5917 struct extent_buffer *leaf = path->nodes[0];
5930 di = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dir_item);
5934 btrfs_release_path(path);
5962 btrfs_release_path(path);
5998 btrfs_free_path(path);
6189 struct btrfs_path *path;
6198 path = btrfs_alloc_path();
6199 if (!path)
6293 ret = btrfs_insert_empty_items(trans, root, path, &batch);
6308 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
6310 memzero_extent_buffer(path->nodes[0], (unsigned long)inode_item,
6312 fill_inode_item(trans, path->nodes[0], inode_item, inode);
6315 ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1,
6319 btrfs_set_inode_ref_name_len(path->nodes[0], ref, 2);
6320 btrfs_set_inode_ref_index(path->nodes[0], ref, 0);
6321 write_extent_buffer(path->nodes[0], "..", ptr, 2);
6323 btrfs_set_inode_ref_name_len(path->nodes[0], ref,
6325 btrfs_set_inode_ref_index(path->nodes[0], ref,
6327 write_extent_buffer(path->nodes[0], name->name, ptr,
6332 btrfs_mark_buffer_dirty(trans, path->nodes[0]);
6334 * We don't need the path anymore, plus inheriting properties, adding
6336 * allocating yet another path. So just free our path.
6338 btrfs_free_path(path);
6339 path = NULL;
6406 btrfs_free_path(path);
6662 static noinline int uncompress_inline(struct btrfs_path *path,
6667 struct extent_buffer *leaf = path->nodes[0];
6676 inline_size = btrfs_file_extent_inline_item_len(leaf, path->slots[0]);
6701 static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *path,
6713 fi = btrfs_item_ptr(path->nodes[0], path->slots[0],
6715 if (btrfs_file_extent_compression(path->nodes[0], fi) != BTRFS_COMPRESS_NONE)
6716 return uncompress_inline(path, page, fi);
6719 btrfs_file_extent_ram_bytes(path->nodes[0], fi));
6721 read_extent_buffer(path->nodes[0], kaddr,
6757 struct btrfs_path *path = NULL;
6787 path = btrfs_alloc_path();
6788 if (!path) {
6794 path->reada = READA_FORWARD;
6802 path->search_commit_root = 1;
6803 path->skip_locking = 1;
6806 ret = btrfs_lookup_file_extent(NULL, root, path, objectid, start, 0);
6810 if (path->slots[0] == 0)
6812 path->slots[0]--;
6816 leaf = path->nodes[0];
6817 item = btrfs_item_ptr(leaf, path->slots[0],
6819 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
6834 extent_end = btrfs_file_extent_end(path);
6849 path->slots[0],
6854 path->slots[0]++;
6855 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
6856 ret = btrfs_next_leaf(root, path);
6862 leaf = path->nodes[0];
6864 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
6881 btrfs_extent_item_to_extent_map(inode, path, item, em);
6889 * ensured by tree-checker and inline extent creation path.
6905 ret = read_inline_extent(inode, path, page);
6917 btrfs_release_path(path);
6930 btrfs_free_path(path);
7058 struct btrfs_path *path;
7067 path = btrfs_alloc_path();
7068 if (!path)
7070 path->nowait = nowait;
7072 ret = btrfs_lookup_file_extent(NULL, root, path,
7078 if (path->slots[0] == 0) {
7083 path->slots[0]--;
7086 leaf = path->nodes[0];
7087 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
7099 if (btrfs_file_extent_end(path) <= offset)
7102 fi = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
7112 ret = can_nocow_file_extent(path, &key, BTRFS_I(inode), &nocow_args);
7113 /* can_nocow_file_extent() has freed the path. */
7114 path = NULL;
7148 btrfs_free_path(path);
7458 * -EAGAIN at this point so that the normal path is used.
7546 * buffered path.
8652 const struct path *path, struct kstat *stat,
8657 struct inode *inode = d_inode(path->dentry);
9395 struct btrfs_path *path;
9441 path = btrfs_alloc_path();
9442 if (!path) {
9453 err = btrfs_insert_empty_item(trans, root, path, &key,
9457 btrfs_free_path(path);
9462 leaf = path->nodes[0];
9463 ei = btrfs_item_ptr(leaf, path->slots[0],
9476 btrfs_free_path(path);
9500 struct btrfs_path *path;
9540 path = btrfs_alloc_path();
9541 if (!path) {
9546 ret = btrfs_replace_file_extents(inode, path, file_offset,
9549 btrfs_free_path(path);
9840 struct btrfs_path *path;
9848 path = btrfs_alloc_path();
9849 if (!path) {
9853 ret = btrfs_lookup_file_extent(NULL, root, path, btrfs_ino(inode),
9862 leaf = path->nodes[0];
9863 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
9879 path->slots[0]);
9900 btrfs_release_path(path);
9910 btrfs_free_path(path);
10259 * size, but the buffered I/O path falls back to no compression for such