Lines Matching refs:path

168 	struct btrfs_path *path;  in btrfs_insert_hole_extent()  local
171 path = btrfs_alloc_path(); in btrfs_insert_hole_extent()
172 if (!path) in btrfs_insert_hole_extent()
178 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_insert_hole_extent()
183 leaf = path->nodes[0]; in btrfs_insert_hole_extent()
184 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_insert_hole_extent()
199 btrfs_free_path(path); in btrfs_insert_hole_extent()
206 struct btrfs_path *path, in btrfs_lookup_csum() argument
222 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); in btrfs_lookup_csum()
225 leaf = path->nodes[0]; in btrfs_lookup_csum()
228 if (path->slots[0] == 0) in btrfs_lookup_csum()
230 path->slots[0]--; in btrfs_lookup_csum()
231 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_lookup_csum()
237 csums_in_item = btrfs_item_size(leaf, path->slots[0]); in btrfs_lookup_csum()
247 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_lookup_csum()
259 struct btrfs_path *path, u64 objectid, in btrfs_lookup_file_extent() argument
270 return btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); in btrfs_lookup_file_extent()
283 struct btrfs_path *path, u64 disk_bytenr, in search_csum_tree() argument
300 if (path->nodes[0]) { in search_csum_tree()
301 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in search_csum_tree()
303 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
304 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
314 btrfs_release_path(path); in search_csum_tree()
316 item = btrfs_lookup_csum(NULL, csum_root, path, disk_bytenr, 0); in search_csum_tree()
321 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
322 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
331 read_extent_buffer(path->nodes[0], dst, (unsigned long)item, in search_csum_tree()
349 struct btrfs_path *path; in btrfs_lookup_bio_sums() local
375 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
376 if (!path) in btrfs_lookup_bio_sums()
382 btrfs_free_path(path); in btrfs_lookup_bio_sums()
394 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
403 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
404 path->skip_locking = 1; in btrfs_lookup_bio_sums()
413 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
453 btrfs_free_path(path); in btrfs_lookup_bio_sums()
463 struct btrfs_path *path; in btrfs_lookup_csums_list() local
473 path = btrfs_alloc_path(); in btrfs_lookup_csums_list()
474 if (!path) in btrfs_lookup_csums_list()
477 path->nowait = nowait; in btrfs_lookup_csums_list()
479 path->skip_locking = 1; in btrfs_lookup_csums_list()
480 path->reada = READA_FORWARD; in btrfs_lookup_csums_list()
481 path->search_commit_root = 1; in btrfs_lookup_csums_list()
488 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_list()
491 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_list()
492 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
493 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_list()
513 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_list()
514 path->slots[0]--; in btrfs_lookup_csums_list()
521 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
522 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_list()
523 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_list()
528 leaf = path->nodes[0]; in btrfs_lookup_csums_list()
531 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_list()
541 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_list()
543 path->slots[0]++; in btrfs_lookup_csums_list()
548 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_list()
568 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_list()
576 path->slots[0]++; in btrfs_lookup_csums_list()
587 btrfs_free_path(path); in btrfs_lookup_csums_list()
600 int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path, in btrfs_lookup_csums_bitmap() argument
615 if (!path) { in btrfs_lookup_csums_bitmap()
616 path = btrfs_alloc_path(); in btrfs_lookup_csums_bitmap()
617 if (!path) in btrfs_lookup_csums_bitmap()
623 if (path->nodes[0]) { in btrfs_lookup_csums_bitmap()
624 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
630 btrfs_release_path(path); in btrfs_lookup_csums_bitmap()
637 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_bitmap()
640 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_bitmap()
641 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
642 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_bitmap()
662 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_bitmap()
663 path->slots[0]--; in btrfs_lookup_csums_bitmap()
671 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
672 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_bitmap()
673 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_bitmap()
678 leaf = path->nodes[0]; in btrfs_lookup_csums_bitmap()
681 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_bitmap()
691 btrfs_item_size(leaf, path->slots[0])); in btrfs_lookup_csums_bitmap()
693 path->slots[0]++; in btrfs_lookup_csums_bitmap()
698 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_bitmap()
710 read_extent_buffer(path->nodes[0], csum_dest, in btrfs_lookup_csums_bitmap()
720 path->slots[0]++; in btrfs_lookup_csums_bitmap()
725 btrfs_free_path(path); in btrfs_lookup_csums_bitmap()
815 struct btrfs_path *path, in truncate_one_csum() argument
826 leaf = path->nodes[0]; in truncate_one_csum()
827 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
840 btrfs_truncate_item(trans, path, new_size, 1); in truncate_one_csum()
852 btrfs_truncate_item(trans, path, new_size, 0); in truncate_one_csum()
855 btrfs_set_item_key_safe(trans, path, key); in truncate_one_csum()
868 struct btrfs_path *path; in btrfs_del_csums() local
880 path = btrfs_alloc_path(); in btrfs_del_csums()
881 if (!path) in btrfs_del_csums()
889 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
892 if (path->slots[0] == 0) in btrfs_del_csums()
894 path->slots[0]--; in btrfs_del_csums()
899 leaf = path->nodes[0]; in btrfs_del_csums()
900 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
910 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
927 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
928 int slot = path->slots[0] - 1; in btrfs_del_csums()
939 path->slots[0] = slot; in btrfs_del_csums()
945 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
946 path->slots[0], del_nr); in btrfs_del_csums()
979 path->slots[0]); in btrfs_del_csums()
989 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
998 truncate_one_csum(trans, path, &key, bytenr, len); in btrfs_del_csums()
1002 btrfs_release_path(path); in btrfs_del_csums()
1004 btrfs_free_path(path); in btrfs_del_csums()
1009 struct btrfs_path *path, in find_next_csum_offset() argument
1012 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
1014 int slot = path->slots[0] + 1; in find_next_csum_offset()
1018 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
1025 slot = path->slots[0]; in find_next_csum_offset()
1028 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
1046 struct btrfs_path *path; in btrfs_csum_file_blocks() local
1060 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
1061 if (!path) in btrfs_csum_file_blocks()
1071 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1074 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1075 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1078 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1088 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1089 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1097 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1115 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1121 btrfs_release_path(path); in btrfs_csum_file_blocks()
1122 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1123 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1125 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1130 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1132 path->slots[0]--; in btrfs_csum_file_blocks()
1135 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1136 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1146 if (csum_offset == btrfs_item_size(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1179 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1180 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1181 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1188 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1201 diff = diff - btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1206 btrfs_extend_item(trans, path, diff); in btrfs_csum_file_blocks()
1212 btrfs_release_path(path); in btrfs_csum_file_blocks()
1228 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1234 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1236 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1238 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1253 btrfs_mark_buffer_dirty(trans, path->nodes[0]); in btrfs_csum_file_blocks()
1255 btrfs_release_path(path); in btrfs_csum_file_blocks()
1260 btrfs_free_path(path); in btrfs_csum_file_blocks()
1265 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1271 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1272 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1281 extent_end = btrfs_file_extent_end(path); in btrfs_extent_item_to_extent_map()
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()