Lines Matching refs:path
168 struct btrfs_path *path;
171 path = btrfs_alloc_path();
172 if (!path)
178 ret = btrfs_insert_empty_item(trans, root, path, &file_key,
183 leaf = path->nodes[0];
184 item = btrfs_item_ptr(leaf, path->slots[0],
199 btrfs_free_path(path);
206 struct btrfs_path *path,
222 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow);
225 leaf = path->nodes[0];
228 if (path->slots[0] == 0)
230 path->slots[0]--;
231 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
237 csums_in_item = btrfs_item_size(leaf, path->slots[0]);
247 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item);
259 struct btrfs_path *path, u64 objectid,
270 return btrfs_search_slot(trans, root, &file_key, path, ins_len, cow);
283 struct btrfs_path *path, u64 disk_bytenr,
300 if (path->nodes[0]) {
301 item = btrfs_item_ptr(path->nodes[0], path->slots[0],
303 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
304 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]);
314 btrfs_release_path(path);
316 item = btrfs_lookup_csum(NULL, csum_root, path, disk_bytenr, 0);
321 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
322 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]);
331 read_extent_buffer(path->nodes[0], dst, (unsigned long)item,
349 struct btrfs_path *path;
368 * path.
375 path = btrfs_alloc_path();
376 if (!path)
382 btrfs_free_path(path);
394 path->reada = READA_FORWARD;
403 path->search_commit_root = 1;
404 path->skip_locking = 1;
413 count = search_csum_tree(fs_info, path, cur_disk_bytenr,
453 btrfs_free_path(path);
463 struct btrfs_path *path;
473 path = btrfs_alloc_path();
474 if (!path)
477 path->nowait = nowait;
479 path->skip_locking = 1;
480 path->reada = READA_FORWARD;
481 path->search_commit_root = 1;
488 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
491 if (ret > 0 && path->slots[0] > 0) {
492 leaf = path->nodes[0];
493 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1);
513 btrfs_item_size(leaf, path->slots[0] - 1))
514 path->slots[0]--;
521 leaf = path->nodes[0];
522 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
523 ret = btrfs_next_leaf(root, path);
528 leaf = path->nodes[0];
531 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
541 btrfs_item_size(leaf, path->slots[0]));
543 path->slots[0]++;
548 item = btrfs_item_ptr(path->nodes[0], path->slots[0],
568 read_extent_buffer(path->nodes[0],
576 path->slots[0]++;
587 btrfs_free_path(path);
600 int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path,
615 if (!path) {
616 path = btrfs_alloc_path();
617 if (!path)
622 /* Check if we can reuse the previous path. */
623 if (path->nodes[0]) {
624 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
630 btrfs_release_path(path);
637 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
640 if (ret > 0 && path->slots[0] > 0) {
641 leaf = path->nodes[0];
642 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1);
662 btrfs_item_size(leaf, path->slots[0] - 1))
663 path->slots[0]--;
671 leaf = path->nodes[0];
672 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
673 ret = btrfs_next_leaf(root, path);
678 leaf = path->nodes[0];
681 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
691 btrfs_item_size(leaf, path->slots[0]));
693 path->slots[0]++;
698 item = btrfs_item_ptr(path->nodes[0], path->slots[0],
710 read_extent_buffer(path->nodes[0], csum_dest,
720 path->slots[0]++;
725 btrfs_free_path(path);
805 * This expects the key to describe the csum pointed to by the path, and it
815 struct btrfs_path *path,
826 leaf = path->nodes[0];
827 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size;
840 btrfs_truncate_item(trans, path, new_size, 1);
852 btrfs_truncate_item(trans, path, new_size, 0);
855 btrfs_set_item_key_safe(trans, path, key);
868 struct btrfs_path *path;
880 path = btrfs_alloc_path();
881 if (!path)
889 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
892 if (path->slots[0] == 0)
894 path->slots[0]--;
899 leaf = path->nodes[0];
900 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
910 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size;
927 if (key.offset > bytenr && path->slots[0] > 0) {
928 int slot = path->slots[0] - 1;
939 path->slots[0] = slot;
945 ret = btrfs_del_items(trans, root, path,
946 path->slots[0], del_nr);
962 * But we can't drop the path because the
979 path->slots[0]);
989 ret = btrfs_split_item(trans, root, path, &key, offset);
998 truncate_one_csum(trans, path, &key, bytenr, len);
1002 btrfs_release_path(path);
1004 btrfs_free_path(path);
1009 struct btrfs_path *path,
1012 const u32 nritems = btrfs_header_nritems(path->nodes[0]);
1014 int slot = path->slots[0] + 1;
1018 ret = btrfs_next_leaf(root, path);
1025 slot = path->slots[0];
1028 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot);
1046 struct btrfs_path *path;
1060 path = btrfs_alloc_path();
1061 if (!path)
1071 item = btrfs_lookup_csum(trans, root, path, bytenr, 1);
1074 leaf = path->nodes[0];
1075 item_end = btrfs_item_ptr(leaf, path->slots[0],
1078 btrfs_item_size(leaf, path->slots[0]));
1088 leaf = path->nodes[0];
1089 item_size = btrfs_item_size(leaf, path->slots[0]);
1097 ret = find_next_csum_offset(root, path, &next_offset);
1112 * release the path and do a search for insertion before the extension.
1115 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
1121 btrfs_release_path(path);
1122 path->search_for_extension = 1;
1123 ret = btrfs_search_slot(trans, root, &file_key, path,
1125 path->search_for_extension = 0;
1130 if (path->slots[0] == 0)
1132 path->slots[0]--;
1135 leaf = path->nodes[0];
1136 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
1146 if (csum_offset == btrfs_item_size(leaf, path->slots[0]) /
1173 * item - it is not worth the complexity of releasing the path,
1179 if (path->slots[0] + 1 >=
1180 btrfs_header_nritems(path->nodes[0])) {
1181 ret = find_next_csum_offset(root, path, &next_offset);
1188 ret = find_next_csum_offset(root, path, &next_offset);
1201 diff = diff - btrfs_item_size(leaf, path->slots[0]);
1206 btrfs_extend_item(trans, path, diff);
1212 btrfs_release_path(path);
1228 ret = btrfs_insert_empty_item(trans, root, path, &file_key,
1234 leaf = path->nodes[0];
1236 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item);
1238 btrfs_item_size(leaf, path->slots[0]));
1253 btrfs_mark_buffer_dirty(trans, path->nodes[0]);
1255 btrfs_release_path(path);
1260 btrfs_free_path(path);
1265 const struct btrfs_path *path,
1271 struct extent_buffer *leaf = path->nodes[0];
1272 const int slot = path->slots[0];
1281 extent_end = btrfs_file_extent_end(path);
1330 * Returns the end offset (non inclusive) of the file extent item the given path
1334 u64 btrfs_file_extent_end(const struct btrfs_path *path)
1336 const struct extent_buffer *leaf = path->nodes[0];
1337 const int slot = path->slots[0];