Lines Matching full:path
166 struct btrfs_path *path; in btrfs_insert_hole_extent() local
169 path = btrfs_alloc_path(); in btrfs_insert_hole_extent()
170 if (!path) in btrfs_insert_hole_extent()
176 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_insert_hole_extent()
180 leaf = path->nodes[0]; in btrfs_insert_hole_extent()
181 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_insert_hole_extent()
194 btrfs_free_path(path); 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 struct btrfs_path *path; in btrfs_lookup_bio_sums() local
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()
377 btrfs_free_path(path); in btrfs_lookup_bio_sums()
389 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
398 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
399 path->skip_locking = 1; in btrfs_lookup_bio_sums()
408 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
447 btrfs_free_path(path); in btrfs_lookup_bio_sums()
470 struct btrfs_path *path; in btrfs_lookup_csums_list() local
480 path = btrfs_alloc_path(); in btrfs_lookup_csums_list()
481 if (!path) in btrfs_lookup_csums_list()
484 path->nowait = nowait; in btrfs_lookup_csums_list()
490 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_list()
493 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_list()
494 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
495 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_list()
515 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_list()
516 path->slots[0]--; in btrfs_lookup_csums_list()
523 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
524 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_list()
525 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_list()
530 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
533 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_list()
543 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_list()
545 path->slots[0]++; in btrfs_lookup_csums_list()
554 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_list()
574 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_list()
582 path->slots[0]++; in btrfs_lookup_csums_list()
585 btrfs_free_path(path); in btrfs_lookup_csums_list()
609 int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path, in btrfs_lookup_csums_bitmap() argument
624 if (!path) { in btrfs_lookup_csums_bitmap()
625 path = btrfs_alloc_path(); in btrfs_lookup_csums_bitmap()
626 if (!path) in btrfs_lookup_csums_bitmap()
631 /* Check if we can reuse the previous path. */ in btrfs_lookup_csums_bitmap()
632 if (path->nodes[0]) { in btrfs_lookup_csums_bitmap()
633 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
639 btrfs_release_path(path); in btrfs_lookup_csums_bitmap()
646 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_bitmap()
649 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_bitmap()
650 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
651 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_bitmap()
671 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_bitmap()
672 path->slots[0]--; in btrfs_lookup_csums_bitmap()
680 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
681 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_bitmap()
682 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_bitmap()
687 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
690 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
700 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_bitmap()
702 path->slots[0]++; in btrfs_lookup_csums_bitmap()
707 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_bitmap()
719 read_extent_buffer(path->nodes[0], csum_dest, in btrfs_lookup_csums_bitmap()
729 path->slots[0]++; in btrfs_lookup_csums_bitmap()
734 btrfs_free_path(path); in btrfs_lookup_csums_bitmap()
814 * This expects the key to describe the csum pointed to by the path, and it
824 struct btrfs_path *path, in truncate_one_csum() argument
835 leaf = path->nodes[0]; in truncate_one_csum()
836 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
849 btrfs_truncate_item(trans, path, new_size, 1); in truncate_one_csum()
861 btrfs_truncate_item(trans, path, new_size, 0); in truncate_one_csum()
864 btrfs_set_item_key_safe(trans, path, key); in truncate_one_csum()
877 struct btrfs_path *path; in btrfs_del_csums() local
889 path = btrfs_alloc_path(); in btrfs_del_csums()
890 if (!path) in btrfs_del_csums()
898 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
901 if (path->slots[0] == 0) in btrfs_del_csums()
903 path->slots[0]--; in btrfs_del_csums()
908 leaf = path->nodes[0]; in btrfs_del_csums()
909 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
919 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
936 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
937 int slot = path->slots[0] - 1; in btrfs_del_csums()
948 path->slots[0] = slot; in btrfs_del_csums()
954 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
955 path->slots[0], del_nr); in btrfs_del_csums()
971 * But we can't drop the path because the in btrfs_del_csums()
988 path->slots[0]); in btrfs_del_csums()
998 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
1007 truncate_one_csum(trans, path, &key, bytenr, len); in btrfs_del_csums()
1011 btrfs_release_path(path); in btrfs_del_csums()
1013 btrfs_free_path(path); in btrfs_del_csums()
1018 struct btrfs_path *path, in find_next_csum_offset() argument
1021 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
1023 int slot = path->slots[0] + 1; in find_next_csum_offset()
1027 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
1034 slot = path->slots[0]; in find_next_csum_offset()
1037 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
1055 struct btrfs_path *path; in btrfs_csum_file_blocks() local
1069 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
1070 if (!path) in btrfs_csum_file_blocks()
1080 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1083 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1084 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1087 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1097 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1098 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1106 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1121 * release the path and do a search for insertion before the extension. in btrfs_csum_file_blocks()
1124 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1130 btrfs_release_path(path); in btrfs_csum_file_blocks()
1131 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1132 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1134 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1139 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1141 path->slots[0]--; in btrfs_csum_file_blocks()
1144 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1145 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1155 if (csum_offset == btrfs_item_size(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1182 * item - it is not worth the complexity of releasing the path, in btrfs_csum_file_blocks()
1188 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1189 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1190 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1197 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1210 diff = diff - btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1215 btrfs_extend_item(trans, path, diff); in btrfs_csum_file_blocks()
1221 btrfs_release_path(path); in btrfs_csum_file_blocks()
1237 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1241 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1243 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1245 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1261 btrfs_release_path(path); in btrfs_csum_file_blocks()
1266 btrfs_free_path(path); in btrfs_csum_file_blocks()
1271 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1277 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1278 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1293 em->len = btrfs_file_extent_end(path) - extent_start; in btrfs_extent_item_to_extent_map()
1334 * Returns the end offset (non inclusive) of the file extent item the given path
1338 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1340 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1341 const int slot = path->slots[0]; in btrfs_file_extent_end()