Lines Matching full: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
388 * path. in btrfs_lookup_bio_sums()
395 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
396 if (!path) in btrfs_lookup_bio_sums()
406 btrfs_free_path(path); in btrfs_lookup_bio_sums()
422 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
431 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
432 path->skip_locking = 1; in btrfs_lookup_bio_sums()
455 count = search_csum_tree(fs_info, path, cur_disk_bytenr, in btrfs_lookup_bio_sums()
491 btrfs_free_path(path); in btrfs_lookup_bio_sums()
500 struct btrfs_path *path; in btrfs_lookup_csums_range() local
514 path = btrfs_alloc_path(); in btrfs_lookup_csums_range()
515 if (!path) in btrfs_lookup_csums_range()
519 path->skip_locking = 1; in btrfs_lookup_csums_range()
520 path->reada = READA_FORWARD; in btrfs_lookup_csums_range()
521 path->search_commit_root = 1; in btrfs_lookup_csums_range()
528 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_range()
531 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_range()
532 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
533 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_range()
538 btrfs_item_size_nr(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_range()
539 path->slots[0]--; in btrfs_lookup_csums_range()
544 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
545 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_range()
546 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_range()
551 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
554 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_range()
563 size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_lookup_csums_range()
566 path->slots[0]++; in btrfs_lookup_csums_range()
571 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_range()
590 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_range()
598 path->slots[0]++; in btrfs_lookup_csums_range()
609 btrfs_free_path(path); in btrfs_lookup_csums_range()
733 * key to describe the csum pointed to by the path, and it expects
743 struct btrfs_path *path, in truncate_one_csum() argument
753 leaf = path->nodes[0]; in truncate_one_csum()
754 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
767 btrfs_truncate_item(path, new_size, 1); in truncate_one_csum()
779 btrfs_truncate_item(path, new_size, 0); in truncate_one_csum()
782 btrfs_set_item_key_safe(fs_info, path, key); in truncate_one_csum()
796 struct btrfs_path *path; in btrfs_del_csums() local
808 path = btrfs_alloc_path(); in btrfs_del_csums()
809 if (!path) in btrfs_del_csums()
817 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
820 if (path->slots[0] == 0) in btrfs_del_csums()
822 path->slots[0]--; in btrfs_del_csums()
827 leaf = path->nodes[0]; in btrfs_del_csums()
828 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
838 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
855 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
856 int slot = path->slots[0] - 1; in btrfs_del_csums()
867 path->slots[0] = slot; in btrfs_del_csums()
873 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
874 path->slots[0], del_nr); in btrfs_del_csums()
890 * But we can't drop the path because the in btrfs_del_csums()
907 path->slots[0]); in btrfs_del_csums()
917 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
926 truncate_one_csum(fs_info, path, &key, bytenr, len); in btrfs_del_csums()
930 btrfs_release_path(path); in btrfs_del_csums()
932 btrfs_free_path(path); in btrfs_del_csums()
937 struct btrfs_path *path, in find_next_csum_offset() argument
940 const u32 nritems = btrfs_header_nritems(path->nodes[0]); in find_next_csum_offset()
942 int slot = path->slots[0] + 1; in find_next_csum_offset()
946 ret = btrfs_next_leaf(root, path); in find_next_csum_offset()
953 slot = path->slots[0]; in find_next_csum_offset()
956 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in find_next_csum_offset()
974 struct btrfs_path *path; in btrfs_csum_file_blocks() local
988 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
989 if (!path) in btrfs_csum_file_blocks()
999 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
1002 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1003 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
1006 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1016 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1017 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1025 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1040 * release the path and do a search for insertion before the extension. in btrfs_csum_file_blocks()
1043 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1049 btrfs_release_path(path); in btrfs_csum_file_blocks()
1050 path->search_for_extension = 1; in btrfs_csum_file_blocks()
1051 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
1053 path->search_for_extension = 0; in btrfs_csum_file_blocks()
1058 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
1060 path->slots[0]--; in btrfs_csum_file_blocks()
1063 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1064 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
1074 if (csum_offset == btrfs_item_size_nr(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
1101 * item - it is not worth the complexity of releasing the path, in btrfs_csum_file_blocks()
1107 if (path->slots[0] + 1 >= in btrfs_csum_file_blocks()
1108 btrfs_header_nritems(path->nodes[0])) { in btrfs_csum_file_blocks()
1109 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1116 ret = find_next_csum_offset(root, path, &next_offset); in btrfs_csum_file_blocks()
1129 diff = diff - btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
1134 btrfs_extend_item(path, diff); in btrfs_csum_file_blocks()
1140 btrfs_release_path(path); in btrfs_csum_file_blocks()
1156 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1162 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1164 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1166 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1181 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_csum_file_blocks()
1183 btrfs_release_path(path); in btrfs_csum_file_blocks()
1188 btrfs_free_path(path); in btrfs_csum_file_blocks()
1193 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1200 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1201 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1210 extent_end = btrfs_file_extent_end(path); in btrfs_extent_item_to_extent_map()
1259 * Returns the end offset (non inclusive) of the file extent item the given path
1263 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1265 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1266 const int slot = path->slots[0]; in btrfs_file_extent_end()