Lines Matching refs:path
135 struct btrfs_path *path; in btrfs_insert_file_extent() local
138 path = btrfs_alloc_path(); in btrfs_insert_file_extent()
139 if (!path) in btrfs_insert_file_extent()
145 path->leave_spinning = 1; in btrfs_insert_file_extent()
146 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_insert_file_extent()
151 leaf = path->nodes[0]; in btrfs_insert_file_extent()
152 item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_insert_file_extent()
167 btrfs_free_path(path); in btrfs_insert_file_extent()
174 struct btrfs_path *path, in btrfs_lookup_csum() argument
190 ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow); in btrfs_lookup_csum()
193 leaf = path->nodes[0]; in btrfs_lookup_csum()
196 if (path->slots[0] == 0) in btrfs_lookup_csum()
198 path->slots[0]--; in btrfs_lookup_csum()
199 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_lookup_csum()
205 csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_lookup_csum()
215 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_lookup_csum()
227 struct btrfs_path *path, u64 objectid, in btrfs_lookup_file_extent() argument
238 ret = btrfs_search_slot(trans, root, &file_key, path, ins_len, cow); in btrfs_lookup_file_extent()
263 struct btrfs_path *path; in btrfs_lookup_bio_sums() local
275 path = btrfs_alloc_path(); in btrfs_lookup_bio_sums()
276 if (!path) in btrfs_lookup_bio_sums()
287 btrfs_free_path(path); in btrfs_lookup_bio_sums()
299 path->reada = READA_FORWARD; in btrfs_lookup_bio_sums()
308 path->search_commit_root = 1; in btrfs_lookup_bio_sums()
309 path->skip_locking = 1; in btrfs_lookup_bio_sums()
332 btrfs_release_path(path); in btrfs_lookup_bio_sums()
334 path, disk_bytenr, 0); in btrfs_lookup_bio_sums()
349 btrfs_release_path(path); in btrfs_lookup_bio_sums()
352 btrfs_item_key_to_cpu(path->nodes[0], &found_key, in btrfs_lookup_bio_sums()
353 path->slots[0]); in btrfs_lookup_bio_sums()
356 item_size = btrfs_item_size_nr(path->nodes[0], in btrfs_lookup_bio_sums()
357 path->slots[0]); in btrfs_lookup_bio_sums()
361 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_bio_sums()
373 read_extent_buffer(path->nodes[0], csum, in btrfs_lookup_bio_sums()
391 btrfs_free_path(path); in btrfs_lookup_bio_sums()
400 struct btrfs_path *path; in btrfs_lookup_csums_range() local
414 path = btrfs_alloc_path(); in btrfs_lookup_csums_range()
415 if (!path) in btrfs_lookup_csums_range()
419 path->skip_locking = 1; in btrfs_lookup_csums_range()
420 path->reada = READA_FORWARD; in btrfs_lookup_csums_range()
421 path->search_commit_root = 1; in btrfs_lookup_csums_range()
428 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_range()
431 if (ret > 0 && path->slots[0] > 0) { in btrfs_lookup_csums_range()
432 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
433 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_range()
439 btrfs_item_size_nr(leaf, path->slots[0] - 1)) in btrfs_lookup_csums_range()
440 path->slots[0]--; in btrfs_lookup_csums_range()
445 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
446 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_lookup_csums_range()
447 ret = btrfs_next_leaf(root, path); in btrfs_lookup_csums_range()
452 leaf = path->nodes[0]; in btrfs_lookup_csums_range()
455 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_range()
464 size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_lookup_csums_range()
467 path->slots[0]++; in btrfs_lookup_csums_range()
472 item = btrfs_item_ptr(path->nodes[0], path->slots[0], in btrfs_lookup_csums_range()
492 read_extent_buffer(path->nodes[0], in btrfs_lookup_csums_range()
500 path->slots[0]++; in btrfs_lookup_csums_range()
511 btrfs_free_path(path); in btrfs_lookup_csums_range()
646 struct btrfs_path *path, in truncate_one_csum() argument
656 leaf = path->nodes[0]; in truncate_one_csum()
657 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
670 btrfs_truncate_item(path, new_size, 1); in truncate_one_csum()
682 btrfs_truncate_item(path, new_size, 0); in truncate_one_csum()
685 btrfs_set_item_key_safe(fs_info, path, key); in truncate_one_csum()
699 struct btrfs_path *path; in btrfs_del_csums() local
711 path = btrfs_alloc_path(); in btrfs_del_csums()
712 if (!path) in btrfs_del_csums()
720 path->leave_spinning = 1; in btrfs_del_csums()
721 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
724 if (path->slots[0] == 0) in btrfs_del_csums()
726 path->slots[0]--; in btrfs_del_csums()
731 leaf = path->nodes[0]; in btrfs_del_csums()
732 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
742 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
759 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
760 int slot = path->slots[0] - 1; in btrfs_del_csums()
771 path->slots[0] = slot; in btrfs_del_csums()
777 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
778 path->slots[0], del_nr); in btrfs_del_csums()
811 path->slots[0]); in btrfs_del_csums()
821 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
830 truncate_one_csum(fs_info, path, &key, bytenr, len); in btrfs_del_csums()
834 btrfs_release_path(path); in btrfs_del_csums()
836 btrfs_free_path(path); in btrfs_del_csums()
847 struct btrfs_path *path; in btrfs_csum_file_blocks() local
862 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
863 if (!path) in btrfs_csum_file_blocks()
873 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
876 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
877 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
880 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
890 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
891 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
898 int slot = path->slots[0] + 1; in btrfs_csum_file_blocks()
900 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_csum_file_blocks()
901 if (!nritems || (path->slots[0] >= nritems - 1)) { in btrfs_csum_file_blocks()
902 ret = btrfs_next_leaf(root, path); in btrfs_csum_file_blocks()
909 slot = path->slots[0]; in btrfs_csum_file_blocks()
911 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in btrfs_csum_file_blocks()
933 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
939 btrfs_release_path(path); in btrfs_csum_file_blocks()
940 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
946 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
948 path->slots[0]--; in btrfs_csum_file_blocks()
951 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
952 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
963 if (csum_offset == btrfs_item_size_nr(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
978 diff = diff - btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
983 btrfs_extend_item(path, diff); in btrfs_csum_file_blocks()
989 btrfs_release_path(path); in btrfs_csum_file_blocks()
1005 path->leave_spinning = 1; in btrfs_csum_file_blocks()
1006 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
1008 path->leave_spinning = 0; in btrfs_csum_file_blocks()
1013 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1015 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1017 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1033 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_csum_file_blocks()
1035 btrfs_release_path(path); in btrfs_csum_file_blocks()
1040 btrfs_free_path(path); in btrfs_csum_file_blocks()
1045 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1052 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1053 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1062 extent_end = btrfs_file_extent_end(path); in btrfs_extent_item_to_extent_map()
1115 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1117 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1118 const int slot = path->slots[0]; in btrfs_file_extent_end()