Lines Matching refs:path
135 struct btrfs_path *path;
138 path = btrfs_alloc_path();
139 if (!path)
145 path->leave_spinning = 1;
146 ret = btrfs_insert_empty_item(trans, root, path, &file_key,
151 leaf = path->nodes[0];
152 item = btrfs_item_ptr(leaf, path->slots[0],
167 btrfs_free_path(path);
174 struct btrfs_path *path,
190 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow);
193 leaf = path->nodes[0];
196 if (path->slots[0] == 0)
198 path->slots[0]--;
199 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
205 csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]);
215 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item);
227 struct btrfs_path *path, u64 objectid,
238 ret = btrfs_search_slot(trans, root, &file_key, path, ins_len, cow);
263 struct btrfs_path *path;
275 path = btrfs_alloc_path();
276 if (!path)
287 btrfs_free_path(path);
299 path->reada = READA_FORWARD;
308 path->search_commit_root = 1;
309 path->skip_locking = 1;
332 btrfs_release_path(path);
334 path, disk_bytenr, 0);
349 btrfs_release_path(path);
352 btrfs_item_key_to_cpu(path->nodes[0], &found_key,
353 path->slots[0]);
356 item_size = btrfs_item_size_nr(path->nodes[0],
357 path->slots[0]);
361 item = btrfs_item_ptr(path->nodes[0], path->slots[0],
373 read_extent_buffer(path->nodes[0], csum,
391 btrfs_free_path(path);
400 struct btrfs_path *path;
414 path = btrfs_alloc_path();
415 if (!path)
419 path->skip_locking = 1;
420 path->reada = READA_FORWARD;
421 path->search_commit_root = 1;
428 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
431 if (ret > 0 && path->slots[0] > 0) {
432 leaf = path->nodes[0];
433 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1);
439 btrfs_item_size_nr(leaf, path->slots[0] - 1))
440 path->slots[0]--;
445 leaf = path->nodes[0];
446 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
447 ret = btrfs_next_leaf(root, path);
452 leaf = path->nodes[0];
455 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
464 size = btrfs_item_size_nr(leaf, path->slots[0]);
467 path->slots[0]++;
472 item = btrfs_item_ptr(path->nodes[0], path->slots[0],
492 read_extent_buffer(path->nodes[0],
500 path->slots[0]++;
511 btrfs_free_path(path);
638 * key to describe the csum pointed to by the path, and it expects
648 struct btrfs_path *path,
658 leaf = path->nodes[0];
659 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size;
672 btrfs_truncate_item(path, new_size, 1);
684 btrfs_truncate_item(path, new_size, 0);
687 btrfs_set_item_key_safe(fs_info, path, key);
701 struct btrfs_path *path;
713 path = btrfs_alloc_path();
714 if (!path)
722 path->leave_spinning = 1;
723 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
726 if (path->slots[0] == 0)
728 path->slots[0]--;
733 leaf = path->nodes[0];
734 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
744 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size;
761 if (key.offset > bytenr && path->slots[0] > 0) {
762 int slot = path->slots[0] - 1;
773 path->slots[0] = slot;
779 ret = btrfs_del_items(trans, root, path,
780 path->slots[0], del_nr);
796 * But we can't drop the path because the
813 path->slots[0]);
823 ret = btrfs_split_item(trans, root, path, &key, offset);
832 truncate_one_csum(fs_info, path, &key, bytenr, len);
836 btrfs_release_path(path);
838 btrfs_free_path(path);
849 struct btrfs_path *path;
864 path = btrfs_alloc_path();
865 if (!path)
875 item = btrfs_lookup_csum(trans, root, path, bytenr, 1);
878 leaf = path->nodes[0];
879 item_end = btrfs_item_ptr(leaf, path->slots[0],
882 btrfs_item_size_nr(leaf, path->slots[0]));
892 leaf = path->nodes[0];
893 item_size = btrfs_item_size_nr(leaf, path->slots[0]);
900 int slot = path->slots[0] + 1;
902 nritems = btrfs_header_nritems(path->nodes[0]);
903 if (!nritems || (path->slots[0] >= nritems - 1)) {
904 ret = btrfs_next_leaf(root, path);
911 slot = path->slots[0];
913 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot);
932 * release the path and do a search for insertion before the extension.
935 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
941 btrfs_release_path(path);
942 ret = btrfs_search_slot(trans, root, &file_key, path,
948 if (path->slots[0] == 0)
950 path->slots[0]--;
953 leaf = path->nodes[0];
954 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
965 if (csum_offset == btrfs_item_size_nr(leaf, path->slots[0]) /
980 diff = diff - btrfs_item_size_nr(leaf, path->slots[0]);
985 btrfs_extend_item(path, diff);
991 btrfs_release_path(path);
1007 path->leave_spinning = 1;
1008 ret = btrfs_insert_empty_item(trans, root, path, &file_key,
1010 path->leave_spinning = 0;
1015 leaf = path->nodes[0];
1017 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item);
1019 btrfs_item_size_nr(leaf, path->slots[0]));
1035 btrfs_mark_buffer_dirty(path->nodes[0]);
1037 btrfs_release_path(path);
1042 btrfs_free_path(path);
1047 const struct btrfs_path *path,
1054 struct extent_buffer *leaf = path->nodes[0];
1055 const int slot = path->slots[0];
1064 extent_end = btrfs_file_extent_end(path);
1113 * Returns the end offset (non inclusive) of the file extent item the given path
1117 u64 btrfs_file_extent_end(const struct btrfs_path *path)
1119 const struct extent_buffer *leaf = path->nodes[0];
1120 const int slot = path->slots[0];