Lines Matching refs: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()
196 btrfs_free_path(path); in btrfs_insert_hole_extent()
203 struct btrfs_path *path, in btrfs_lookup_csum() argument
219 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); in btrfs_lookup_csum()
222 leaf = path->nodes[0]; in btrfs_lookup_csum()
225 if (path->slots[0] == 0) in btrfs_lookup_csum()
227 path->slots[0]--; in btrfs_lookup_csum()
228 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_lookup_csum()
234 csums_in_item = btrfs_item_size(leaf, path->slots[0]); in btrfs_lookup_csum()
244 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_lookup_csum()
256 struct btrfs_path *path, u64 objectid, in btrfs_lookup_file_extent() argument
267 return btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); in btrfs_lookup_file_extent()
280 struct btrfs_path *path, u64 disk_bytenr, in search_csum_tree() argument
297 if (path->nodes[0]) { in search_csum_tree()
298 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in search_csum_tree()
300 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
301 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
311 btrfs_release_path(path); in search_csum_tree()
313 item = btrfs_lookup_csum(NULL, csum_root, path, disk_bytenr, 0); in search_csum_tree()
318 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
319 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
328 read_extent_buffer(path->nodes[0], dst, (unsigned long)item, in search_csum_tree()
346 struct btrfs_path *path; in btrfs_lookup_bio_sums() local
372 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
373 if (!path) in btrfs_lookup_bio_sums()
379 btrfs_free_path(path); in btrfs_lookup_bio_sums()
391 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
400 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
401 path->skip_locking = 1; in btrfs_lookup_bio_sums()
410 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
449 btrfs_free_path(path); in btrfs_lookup_bio_sums()
472 struct btrfs_path *path; in btrfs_lookup_csums_list() local
482 path = btrfs_alloc_path(); in btrfs_lookup_csums_list()
483 if (!path) in btrfs_lookup_csums_list()
486 path->nowait = nowait; in btrfs_lookup_csums_list()
492 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_list()
495 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_list()
496 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
497 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_list()
517 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_list()
518 path->slots[0]--; in btrfs_lookup_csums_list()
525 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
526 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_list()
527 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_list()
532 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
535 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_list()
545 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_list()
547 path->slots[0]++; in btrfs_lookup_csums_list()
556 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_list()
576 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_list()
584 path->slots[0]++; in btrfs_lookup_csums_list()
587 btrfs_free_path(path); in btrfs_lookup_csums_list()
611 int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path, in btrfs_lookup_csums_bitmap() argument
626 if (!path) { in btrfs_lookup_csums_bitmap()
627 path = btrfs_alloc_path(); in btrfs_lookup_csums_bitmap()
628 if (!path) in btrfs_lookup_csums_bitmap()
634 if (path->nodes[0]) { in btrfs_lookup_csums_bitmap()
635 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
641 btrfs_release_path(path); in btrfs_lookup_csums_bitmap()
648 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_bitmap()
651 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_bitmap()
652 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
653 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_bitmap()
673 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_bitmap()
674 path->slots[0]--; in btrfs_lookup_csums_bitmap()
682 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
683 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_bitmap()
684 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_bitmap()
689 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
692 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
702 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_bitmap()
704 path->slots[0]++; in btrfs_lookup_csums_bitmap()
709 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_bitmap()
721 read_extent_buffer(path->nodes[0], csum_dest, in btrfs_lookup_csums_bitmap()
731 path->slots[0]++; in btrfs_lookup_csums_bitmap()
736 btrfs_free_path(path); in btrfs_lookup_csums_bitmap()
826 struct btrfs_path *path, in truncate_one_csum() argument
837 leaf = path->nodes[0]; in truncate_one_csum()
838 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
851 btrfs_truncate_item(trans, path, new_size, 1); in truncate_one_csum()
863 btrfs_truncate_item(trans, path, new_size, 0); in truncate_one_csum()
866 btrfs_set_item_key_safe(trans, path, key); in truncate_one_csum()
879 struct btrfs_path *path; in btrfs_del_csums() local
891 path = btrfs_alloc_path(); in btrfs_del_csums()
892 if (!path) in btrfs_del_csums()
900 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
903 if (path->slots[0] == 0) in btrfs_del_csums()
905 path->slots[0]--; in btrfs_del_csums()
910 leaf = path->nodes[0]; in btrfs_del_csums()
911 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
921 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
938 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
939 int slot = path->slots[0] - 1; in btrfs_del_csums()
950 path->slots[0] = slot; in btrfs_del_csums()
956 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
957 path->slots[0], del_nr); in btrfs_del_csums()
990 path->slots[0]); in btrfs_del_csums()
1000 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
1009 truncate_one_csum(trans, path, &key, bytenr, len); in btrfs_del_csums()
1013 btrfs_release_path(path); in btrfs_del_csums()
1015 btrfs_free_path(path); in btrfs_del_csums()
1020 struct btrfs_path *path, in find_next_csum_offset() argument
1023 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
1025 int slot = path->slots[0] + 1; in find_next_csum_offset()
1029 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
1036 slot = path->slots[0]; in find_next_csum_offset()
1039 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
1057 struct btrfs_path *path; in btrfs_csum_file_blocks() local
1071 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
1072 if (!path) in btrfs_csum_file_blocks()
1082 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1085 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1086 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1089 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1099 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1100 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1108 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1126 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1132 btrfs_release_path(path); in btrfs_csum_file_blocks()
1133 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1134 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1136 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1141 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1143 path->slots[0]--; in btrfs_csum_file_blocks()
1146 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1147 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1157 if (csum_offset == btrfs_item_size(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1190 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1191 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1192 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1199 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1212 diff = diff - btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1217 btrfs_extend_item(trans, path, diff); in btrfs_csum_file_blocks()
1223 btrfs_release_path(path); in btrfs_csum_file_blocks()
1239 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1243 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1245 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1247 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1262 btrfs_mark_buffer_dirty(trans, path->nodes[0]); in btrfs_csum_file_blocks()
1264 btrfs_release_path(path); in btrfs_csum_file_blocks()
1269 btrfs_free_path(path); in btrfs_csum_file_blocks()
1274 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1280 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1281 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1296 em->len = btrfs_file_extent_end(path) - extent_start; in btrfs_extent_item_to_extent_map()
1341 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1343 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1344 const int slot = path->slots[0]; in btrfs_file_extent_end()