Lines Matching refs:path
142 struct btrfs_path *path; in btrfs_insert_file_extent() local
145 path = btrfs_alloc_path(); in btrfs_insert_file_extent()
146 if (!path) in btrfs_insert_file_extent()
152 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_insert_file_extent()
157 leaf = path->nodes[0]; in btrfs_insert_file_extent()
158 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_insert_file_extent()
173 btrfs_free_path(path); in btrfs_insert_file_extent()
180 struct btrfs_path *path, in btrfs_lookup_csum() argument
196 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); in btrfs_lookup_csum()
199 leaf = path->nodes[0]; in btrfs_lookup_csum()
202 if (path->slots[0] == 0) in btrfs_lookup_csum()
204 path->slots[0]--; in btrfs_lookup_csum()
205 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_lookup_csum()
211 csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_lookup_csum()
221 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_lookup_csum()
233 struct btrfs_path *path, u64 objectid, in btrfs_lookup_file_extent() argument
244 return btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); in btrfs_lookup_file_extent()
257 struct btrfs_path *path, u64 disk_bytenr, in search_csum_tree() argument
273 if (path->nodes[0]) { in search_csum_tree()
274 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in search_csum_tree()
276 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
277 itemsize = btrfs_item_size_nr(path->nodes[0], path->slots[0]); in search_csum_tree()
287 btrfs_release_path(path); in search_csum_tree()
288 item = btrfs_lookup_csum(NULL, fs_info->csum_root, path, disk_bytenr, 0); in search_csum_tree()
293 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in search_csum_tree()
294 itemsize = btrfs_item_size_nr(path->nodes[0], path->slots[0]); in search_csum_tree()
303 read_extent_buffer(path->nodes[0], dst, (unsigned long)item, in search_csum_tree()
369 struct btrfs_path *path; in btrfs_lookup_bio_sums() local
395 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
396 if (!path) in btrfs_lookup_bio_sums()
405 btrfs_free_path(path); in btrfs_lookup_bio_sums()
421 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
430 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
431 path->skip_locking = 1; in btrfs_lookup_bio_sums()
454 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
490 btrfs_free_path(path); in btrfs_lookup_bio_sums()
499 struct btrfs_path *path; in btrfs_lookup_csums_range() local
513 path = btrfs_alloc_path(); in btrfs_lookup_csums_range()
514 if (!path) in btrfs_lookup_csums_range()
518 path->skip_locking = 1; in btrfs_lookup_csums_range()
519 path->reada = READA_FORWARD; in btrfs_lookup_csums_range()
520 path->search_commit_root = 1; in btrfs_lookup_csums_range()
527 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_range()
530 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_range()
531 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
532 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_range()
537 btrfs_item_size_nr(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_range()
538 path->slots[0]--; in btrfs_lookup_csums_range()
543 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
544 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_range()
545 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_range()
550 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
553 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_range()
562 size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_lookup_csums_range()
565 path->slots[0]++; in btrfs_lookup_csums_range()
570 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_range()
589 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_range()
597 path->slots[0]++; in btrfs_lookup_csums_range()
608 btrfs_free_path(path); in btrfs_lookup_csums_range()
742 struct btrfs_path *path, in truncate_one_csum() argument
752 leaf = path->nodes[0]; in truncate_one_csum()
753 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
766 btrfs_truncate_item(path, new_size, 1); in truncate_one_csum()
778 btrfs_truncate_item(path, new_size, 0); in truncate_one_csum()
781 btrfs_set_item_key_safe(fs_info, path, key); in truncate_one_csum()
795 struct btrfs_path *path; in btrfs_del_csums() local
807 path = btrfs_alloc_path(); in btrfs_del_csums()
808 if (!path) in btrfs_del_csums()
816 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
819 if (path->slots[0] == 0) in btrfs_del_csums()
821 path->slots[0]--; in btrfs_del_csums()
826 leaf = path->nodes[0]; in btrfs_del_csums()
827 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
837 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
854 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
855 int slot = path->slots[0] - 1; in btrfs_del_csums()
866 path->slots[0] = slot; in btrfs_del_csums()
872 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
873 path->slots[0], del_nr); in btrfs_del_csums()
906 path->slots[0]); in btrfs_del_csums()
916 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
925 truncate_one_csum(fs_info, path, &key, bytenr, len); in btrfs_del_csums()
929 btrfs_release_path(path); in btrfs_del_csums()
931 btrfs_free_path(path); in btrfs_del_csums()
936 struct btrfs_path *path, in find_next_csum_offset() argument
939 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
941 int slot = path->slots[0] + 1; in find_next_csum_offset()
945 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
952 slot = path->slots[0]; in find_next_csum_offset()
955 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
973 struct btrfs_path *path; in btrfs_csum_file_blocks() local
987 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
988 if (!path) in btrfs_csum_file_blocks()
998 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1001 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1002 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1005 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1015 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1016 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1024 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1042 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1048 btrfs_release_path(path); in btrfs_csum_file_blocks()
1049 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1050 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1052 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1057 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1059 path->slots[0]--; in btrfs_csum_file_blocks()
1062 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1063 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1073 if (csum_offset == btrfs_item_size_nr(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1106 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1107 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1108 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1115 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1128 diff = diff - btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1133 btrfs_extend_item(path, diff); in btrfs_csum_file_blocks()
1139 btrfs_release_path(path); in btrfs_csum_file_blocks()
1155 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1161 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1163 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1165 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1180 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_csum_file_blocks()
1182 btrfs_release_path(path); in btrfs_csum_file_blocks()
1187 btrfs_free_path(path); in btrfs_csum_file_blocks()
1192 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1199 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1200 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1209 extent_end = btrfs_file_extent_end(path); in btrfs_extent_item_to_extent_map()
1262 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1264 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1265 const int slot = path->slots[0]; in btrfs_file_extent_end()