Lines Matching refs:path
150 struct btrfs_path *path; in btrfs_insert_hole_extent() local
153 path = btrfs_alloc_path(); in btrfs_insert_hole_extent()
154 if (!path) in btrfs_insert_hole_extent()
160 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_insert_hole_extent()
165 leaf = path->nodes[0]; in btrfs_insert_hole_extent()
166 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_insert_hole_extent()
181 btrfs_free_path(path); in btrfs_insert_hole_extent()
188 struct btrfs_path *path, in btrfs_lookup_csum() argument
204 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); in btrfs_lookup_csum()
207 leaf = path->nodes[0]; in btrfs_lookup_csum()
210 if (path->slots[0] == 0) in btrfs_lookup_csum()
212 path->slots[0]--; in btrfs_lookup_csum()
213 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_lookup_csum()
219 csums_in_item = btrfs_item_size(leaf, path->slots[0]); in btrfs_lookup_csum()
229 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_lookup_csum()
241 struct btrfs_path *path, u64 objectid, in btrfs_lookup_file_extent() argument
252 return btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); in btrfs_lookup_file_extent()
265 struct btrfs_path *path, u64 disk_bytenr, in search_csum_tree() argument
282 if (path->nodes[0]) { in search_csum_tree()
283 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in search_csum_tree()
285 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
286 itemsize = btrfs_item_size(path->nodes[0], path->slots[0]); in search_csum_tree()
296 btrfs_release_path(path); in search_csum_tree()
298 item = btrfs_lookup_csum(NULL, csum_root, path, disk_bytenr, 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()
313 read_extent_buffer(path->nodes[0], dst, (unsigned long)item, in search_csum_tree()
380 struct btrfs_path *path; in btrfs_lookup_bio_sums() local
408 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
409 if (!path) in btrfs_lookup_bio_sums()
418 btrfs_free_path(path); in btrfs_lookup_bio_sums()
434 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
443 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
444 path->skip_locking = 1; in btrfs_lookup_bio_sums()
467 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
509 btrfs_free_path(path); in btrfs_lookup_bio_sums()
519 struct btrfs_path *path; in btrfs_lookup_csums_range() local
533 path = btrfs_alloc_path(); in btrfs_lookup_csums_range()
534 if (!path) in btrfs_lookup_csums_range()
537 path->nowait = nowait; in btrfs_lookup_csums_range()
539 path->skip_locking = 1; in btrfs_lookup_csums_range()
540 path->reada = READA_FORWARD; in btrfs_lookup_csums_range()
541 path->search_commit_root = 1; in btrfs_lookup_csums_range()
548 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_range()
551 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_range()
552 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
553 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_range()
558 btrfs_item_size(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_range()
559 path->slots[0]--; in btrfs_lookup_csums_range()
564 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
565 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_range()
566 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_range()
571 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
574 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_range()
583 size = btrfs_item_size(leaf, path->slots[0]); in btrfs_lookup_csums_range()
586 path->slots[0]++; in btrfs_lookup_csums_range()
591 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_range()
610 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_range()
618 path->slots[0]++; in btrfs_lookup_csums_range()
629 btrfs_free_path(path); in btrfs_lookup_csums_range()
760 struct btrfs_path *path, in truncate_one_csum() argument
770 leaf = path->nodes[0]; in truncate_one_csum()
771 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
784 btrfs_truncate_item(path, new_size, 1); in truncate_one_csum()
796 btrfs_truncate_item(path, new_size, 0); in truncate_one_csum()
799 btrfs_set_item_key_safe(fs_info, path, key); in truncate_one_csum()
813 struct btrfs_path *path; in btrfs_del_csums() local
825 path = btrfs_alloc_path(); in btrfs_del_csums()
826 if (!path) in btrfs_del_csums()
834 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
837 if (path->slots[0] == 0) in btrfs_del_csums()
839 path->slots[0]--; in btrfs_del_csums()
844 leaf = path->nodes[0]; in btrfs_del_csums()
845 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
855 csum_end = btrfs_item_size(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
872 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
873 int slot = path->slots[0] - 1; in btrfs_del_csums()
884 path->slots[0] = slot; in btrfs_del_csums()
890 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
891 path->slots[0], del_nr); in btrfs_del_csums()
924 path->slots[0]); in btrfs_del_csums()
934 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
943 truncate_one_csum(fs_info, path, &key, bytenr, len); in btrfs_del_csums()
947 btrfs_release_path(path); in btrfs_del_csums()
949 btrfs_free_path(path); in btrfs_del_csums()
954 struct btrfs_path *path, in find_next_csum_offset() argument
957 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
959 int slot = path->slots[0] + 1; in find_next_csum_offset()
963 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
970 slot = path->slots[0]; in find_next_csum_offset()
973 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
991 struct btrfs_path *path; in btrfs_csum_file_blocks() local
1005 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
1006 if (!path) in btrfs_csum_file_blocks()
1016 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1019 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1020 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1023 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1033 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1034 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1042 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1060 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1066 btrfs_release_path(path); in btrfs_csum_file_blocks()
1067 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1068 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1070 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1075 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1077 path->slots[0]--; in btrfs_csum_file_blocks()
1080 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1081 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1091 if (csum_offset == btrfs_item_size(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1124 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1125 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1126 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1133 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1146 diff = diff - btrfs_item_size(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1151 btrfs_extend_item(path, diff); in btrfs_csum_file_blocks()
1157 btrfs_release_path(path); in btrfs_csum_file_blocks()
1173 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1179 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1181 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1183 btrfs_item_size(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1198 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_csum_file_blocks()
1200 btrfs_release_path(path); in btrfs_csum_file_blocks()
1205 btrfs_free_path(path); in btrfs_csum_file_blocks()
1210 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1217 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1218 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1227 extent_end = btrfs_file_extent_end(path); in btrfs_extent_item_to_extent_map()
1281 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1283 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1284 const int slot = path->slots[0]; in btrfs_file_extent_end()