Lines Matching full: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()
625 * key to describe the csum pointed to by the path, and it expects
635 struct btrfs_path *path, in truncate_one_csum() argument
645 leaf = path->nodes[0]; in truncate_one_csum()
646 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in truncate_one_csum()
659 btrfs_truncate_item(path, new_size, 1); in truncate_one_csum()
671 btrfs_truncate_item(path, new_size, 0); in truncate_one_csum()
674 btrfs_set_item_key_safe(fs_info, path, key); in truncate_one_csum()
688 struct btrfs_path *path; in btrfs_del_csums() local
700 path = btrfs_alloc_path(); in btrfs_del_csums()
701 if (!path) in btrfs_del_csums()
709 path->leave_spinning = 1; in btrfs_del_csums()
710 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
712 if (path->slots[0] == 0) in btrfs_del_csums()
714 path->slots[0]--; in btrfs_del_csums()
719 leaf = path->nodes[0]; in btrfs_del_csums()
720 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
730 csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size; in btrfs_del_csums()
747 if (key.offset > bytenr && path->slots[0] > 0) { in btrfs_del_csums()
748 int slot = path->slots[0] - 1; in btrfs_del_csums()
759 path->slots[0] = slot; in btrfs_del_csums()
765 ret = btrfs_del_items(trans, root, path, in btrfs_del_csums()
766 path->slots[0], del_nr); in btrfs_del_csums()
782 * But we can't drop the path because the in btrfs_del_csums()
799 path->slots[0]); in btrfs_del_csums()
809 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
817 truncate_one_csum(fs_info, path, &key, bytenr, len); in btrfs_del_csums()
821 btrfs_release_path(path); in btrfs_del_csums()
825 btrfs_free_path(path); in btrfs_del_csums()
836 struct btrfs_path *path; in btrfs_csum_file_blocks() local
851 path = btrfs_alloc_path(); in btrfs_csum_file_blocks()
852 if (!path) in btrfs_csum_file_blocks()
862 item = btrfs_lookup_csum(trans, root, path, bytenr, 1); in btrfs_csum_file_blocks()
865 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
866 item_end = btrfs_item_ptr(leaf, path->slots[0], in btrfs_csum_file_blocks()
869 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
879 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
880 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
887 int slot = path->slots[0] + 1; in btrfs_csum_file_blocks()
889 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_csum_file_blocks()
890 if (!nritems || (path->slots[0] >= nritems - 1)) { in btrfs_csum_file_blocks()
891 ret = btrfs_next_leaf(root, path); in btrfs_csum_file_blocks()
898 slot = path->slots[0]; in btrfs_csum_file_blocks()
900 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); in btrfs_csum_file_blocks()
919 * release the path and do a search for insertion before the extension. in btrfs_csum_file_blocks()
922 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
928 btrfs_release_path(path); in btrfs_csum_file_blocks()
929 ret = btrfs_search_slot(trans, root, &file_key, path, in btrfs_csum_file_blocks()
935 if (path->slots[0] == 0) in btrfs_csum_file_blocks()
937 path->slots[0]--; in btrfs_csum_file_blocks()
940 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
941 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_csum_file_blocks()
952 if (csum_offset == btrfs_item_size_nr(leaf, path->slots[0]) / in btrfs_csum_file_blocks()
967 diff = diff - btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_csum_file_blocks()
972 btrfs_extend_item(path, diff); in btrfs_csum_file_blocks()
978 btrfs_release_path(path); in btrfs_csum_file_blocks()
994 path->leave_spinning = 1; in btrfs_csum_file_blocks()
995 ret = btrfs_insert_empty_item(trans, root, path, &file_key, in btrfs_csum_file_blocks()
997 path->leave_spinning = 0; in btrfs_csum_file_blocks()
1002 leaf = path->nodes[0]; in btrfs_csum_file_blocks()
1004 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); in btrfs_csum_file_blocks()
1006 btrfs_item_size_nr(leaf, path->slots[0])); in btrfs_csum_file_blocks()
1022 btrfs_mark_buffer_dirty(path->nodes[0]); in btrfs_csum_file_blocks()
1024 btrfs_release_path(path); in btrfs_csum_file_blocks()
1029 btrfs_free_path(path); in btrfs_csum_file_blocks()
1034 const struct btrfs_path *path, in btrfs_extent_item_to_extent_map() argument
1041 struct extent_buffer *leaf = path->nodes[0]; in btrfs_extent_item_to_extent_map()
1042 const int slot = path->slots[0]; in btrfs_extent_item_to_extent_map()
1051 extent_end = btrfs_file_extent_end(path); in btrfs_extent_item_to_extent_map()
1100 * Returns the end offset (non inclusive) of the file extent item the given path
1104 u64 btrfs_file_extent_end(const struct btrfs_path *path) in btrfs_file_extent_end() argument
1106 const struct extent_buffer *leaf = path->nodes[0]; in btrfs_file_extent_end()
1107 const int slot = path->slots[0]; in btrfs_file_extent_end()