Lines Matching full:path
166 BTRFS_PATH_AUTO_FREE(path); in btrfs_insert_hole_extent()
169 path = btrfs_alloc_path(); in btrfs_insert_hole_extent()
170 if (!path) in btrfs_insert_hole_extent()
177 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_insert_hole_extent()
181 leaf = path->nodes[0]; in btrfs_insert_hole_extent()
182 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_insert_hole_extent()
201 struct btrfs_path *path, in btrfs_lookup_csum() argument
217 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); in btrfs_lookup_csum()
220 leaf = path->nodes[0]; in btrfs_lookup_csum()
223 if (path->slots[0] == 0) in btrfs_lookup_csum()
225 path->slots[0]--; in btrfs_lookup_csum()
226 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_lookup_csum()
232 csums_in_item = btrfs_item_size(leaf, path->slots[0]); in btrfs_lookup_csum()
242 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_lookup_csum()
254 struct btrfs_path *path, u64 objectid, in btrfs_lookup_file_extent() argument
265 return btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); in btrfs_lookup_file_extent()
278 struct btrfs_path *path, u64 disk_bytenr, in search_csum_tree() argument
295 if (path->nodes[0]) { in search_csum_tree()
296 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in search_csum_tree()
298 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
299 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
309 btrfs_release_path(path); in search_csum_tree()
311 item = btrfs_lookup_csum(NULL, csum_root, path, disk_bytenr, 0); in search_csum_tree()
316 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
317 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
326 read_extent_buffer(path->nodes[0], dst, (unsigned long)item, in search_csum_tree()
344 BTRFS_PATH_AUTO_FREE(path); in btrfs_lookup_bio_sums()
363 * path. in btrfs_lookup_bio_sums()
370 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
371 if (!path) in btrfs_lookup_bio_sums()
387 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
396 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
397 path->skip_locking = 1; in btrfs_lookup_bio_sums()
406 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
467 struct btrfs_path *path; in btrfs_lookup_csums_list() local
477 path = btrfs_alloc_path(); in btrfs_lookup_csums_list()
478 if (!path) in btrfs_lookup_csums_list()
481 path->nowait = nowait; in btrfs_lookup_csums_list()
487 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_list()
490 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_list()
491 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
492 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_list()
512 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_list()
513 path->slots[0]--; in btrfs_lookup_csums_list()
520 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
521 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_list()
522 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_list()
527 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
530 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_list()
540 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_list()
542 path->slots[0]++; in btrfs_lookup_csums_list()
551 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_list()
571 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_list()
579 path->slots[0]++; in btrfs_lookup_csums_list()
582 btrfs_free_path(path); in btrfs_lookup_csums_list()
606 int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path, in btrfs_lookup_csums_bitmap() argument
621 if (!path) { in btrfs_lookup_csums_bitmap()
622 path = btrfs_alloc_path(); in btrfs_lookup_csums_bitmap()
623 if (!path) in btrfs_lookup_csums_bitmap()
628 /* Check if we can reuse the previous path. */ in btrfs_lookup_csums_bitmap()
629 if (path->nodes[0]) { in btrfs_lookup_csums_bitmap()
630 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
636 btrfs_release_path(path); in btrfs_lookup_csums_bitmap()
643 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_bitmap()
646 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_bitmap()
647 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
648 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_bitmap()
668 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_bitmap()
669 path->slots[0]--; in btrfs_lookup_csums_bitmap()
677 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
678 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_bitmap()
679 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_bitmap()
684 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
687 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
697 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_bitmap()
699 path->slots[0]++; in btrfs_lookup_csums_bitmap()
704 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_bitmap()
716 read_extent_buffer(path->nodes[0], csum_dest, in btrfs_lookup_csums_bitmap()
726 path->slots[0]++; in btrfs_lookup_csums_bitmap()
731 btrfs_free_path(path); in btrfs_lookup_csums_bitmap()
811 * This expects the key to describe the csum pointed to by the path, and it
821 struct btrfs_path *path, in truncate_one_csum() argument
832 leaf = path->nodes[0]; in truncate_one_csum()
833 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
846 btrfs_truncate_item(trans, path, new_size, 1); in truncate_one_csum()
858 btrfs_truncate_item(trans, path, new_size, 0); in truncate_one_csum()
861 btrfs_set_item_key_safe(trans, path, key); in truncate_one_csum()
874 BTRFS_PATH_AUTO_FREE(path); in btrfs_del_csums()
886 path = btrfs_alloc_path(); in btrfs_del_csums()
887 if (!path) in btrfs_del_csums()
895 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
898 if (path->slots[0] == 0) in btrfs_del_csums()
900 path->slots[0]--; in btrfs_del_csums()
905 leaf = path->nodes[0]; in btrfs_del_csums()
906 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
916 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
933 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
934 int slot = path->slots[0] - 1; in btrfs_del_csums()
945 path->slots[0] = slot; in btrfs_del_csums()
951 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
952 path->slots[0], del_nr); in btrfs_del_csums()
968 * But we can't drop the path because the in btrfs_del_csums()
985 path->slots[0]); in btrfs_del_csums()
995 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
1004 truncate_one_csum(trans, path, &key, bytenr, len); in btrfs_del_csums()
1008 btrfs_release_path(path); in btrfs_del_csums()
1014 struct btrfs_path *path, in find_next_csum_offset() argument
1017 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
1019 int slot = path->slots[0] + 1; in find_next_csum_offset()
1023 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
1030 slot = path->slots[0]; in find_next_csum_offset()
1033 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
1051 struct btrfs_path *path; in btrfs_csum_file_blocks() local
1065 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
1066 if (!path) in btrfs_csum_file_blocks()
1076 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1079 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1080 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1083 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1093 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1094 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1102 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1117 * release the path and do a search for insertion before the extension. in btrfs_csum_file_blocks()
1120 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1126 btrfs_release_path(path); in btrfs_csum_file_blocks()
1127 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1128 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1130 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1135 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1137 path->slots[0]--; in btrfs_csum_file_blocks()
1140 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1141 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1151 if (csum_offset == btrfs_item_size(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1178 * item - it is not worth the complexity of releasing the path, in btrfs_csum_file_blocks()
1184 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1185 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1186 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1193 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1206 diff = diff - btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1211 btrfs_extend_item(trans, path, diff); in btrfs_csum_file_blocks()
1217 btrfs_release_path(path); in btrfs_csum_file_blocks()
1233 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1237 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1239 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1241 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1257 btrfs_release_path(path); in btrfs_csum_file_blocks()
1262 btrfs_free_path(path); in btrfs_csum_file_blocks()
1267 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1273 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1274 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1289 em->len = btrfs_file_extent_end(path) - extent_start; in btrfs_extent_item_to_extent_map()
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) in btrfs_file_extent_end() argument
1336 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1337 const int slot = path->slots[0]; in btrfs_file_extent_end()