Lines Matching full:path
22 struct btrfs_path *path);
71 struct btrfs_path *path) in add_new_free_space_info() argument
83 ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*info)); in add_new_free_space_info()
87 leaf = path->nodes[0]; in add_new_free_space_info()
88 info = btrfs_item_ptr(leaf, path->slots[0], in add_new_free_space_info()
96 btrfs_release_path(path); in add_new_free_space_info()
104 struct btrfs_path *path, int cow) in search_free_space_info() argument
115 ret = btrfs_search_slot(trans, root, &key, path, 0, cow); in search_free_space_info()
125 return btrfs_item_ptr(path->nodes[0], path->slots[0], in search_free_space_info()
207 struct btrfs_path *path) in convert_free_space_to_bitmaps() argument
238 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in convert_free_space_to_bitmaps()
242 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
244 path->slots[0]++; in convert_free_space_to_bitmaps()
245 while (path->slots[0] > 0) { in convert_free_space_to_bitmaps()
246 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in convert_free_space_to_bitmaps()
268 path->slots[0]--; in convert_free_space_to_bitmaps()
274 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in convert_free_space_to_bitmaps()
277 btrfs_release_path(path); in convert_free_space_to_bitmaps()
280 info = search_free_space_info(trans, block_group, path, 1); in convert_free_space_to_bitmaps()
285 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
291 btrfs_release_path(path); in convert_free_space_to_bitmaps()
318 ret = btrfs_insert_empty_item(trans, root, path, &key, in convert_free_space_to_bitmaps()
323 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
324 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in convert_free_space_to_bitmaps()
328 btrfs_release_path(path); in convert_free_space_to_bitmaps()
345 struct btrfs_path *path) in convert_free_space_to_extents() argument
375 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in convert_free_space_to_extents()
379 leaf = path->nodes[0]; in convert_free_space_to_extents()
381 path->slots[0]++; in convert_free_space_to_extents()
382 while (path->slots[0] > 0) { in convert_free_space_to_extents()
383 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in convert_free_space_to_extents()
406 ptr = btrfs_item_ptr_offset(leaf, path->slots[0] - 1); in convert_free_space_to_extents()
411 path->slots[0]--; in convert_free_space_to_extents()
417 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in convert_free_space_to_extents()
420 btrfs_release_path(path); in convert_free_space_to_extents()
423 info = search_free_space_info(trans, block_group, path, 1); in convert_free_space_to_extents()
428 leaf = path->nodes[0]; in convert_free_space_to_extents()
434 btrfs_release_path(path); in convert_free_space_to_extents()
447 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in convert_free_space_to_extents()
450 btrfs_release_path(path); in convert_free_space_to_extents()
477 struct btrfs_path *path, in update_free_space_extent_count() argument
488 info = search_free_space_info(trans, block_group, path, 1); in update_free_space_extent_count()
493 flags = btrfs_free_space_flags(path->nodes[0], info); in update_free_space_extent_count()
494 extent_count = btrfs_free_space_extent_count(path->nodes[0], info); in update_free_space_extent_count()
497 btrfs_set_free_space_extent_count(path->nodes[0], info, extent_count); in update_free_space_extent_count()
498 btrfs_mark_buffer_dirty(trans, path->nodes[0]); in update_free_space_extent_count()
499 btrfs_release_path(path); in update_free_space_extent_count()
503 ret = convert_free_space_to_bitmaps(trans, block_group, path); in update_free_space_extent_count()
506 ret = convert_free_space_to_extents(trans, block_group, path); in update_free_space_extent_count()
515 struct btrfs_path *path, u64 offset) in free_space_test_bit() argument
522 leaf = path->nodes[0]; in free_space_test_bit()
523 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in free_space_test_bit()
530 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in free_space_test_bit()
538 struct btrfs_path *path, u64 *start, u64 *size, in free_space_set_bits() argument
548 leaf = path->nodes[0]; in free_space_set_bits()
549 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in free_space_set_bits()
560 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in free_space_set_bits()
575 * btrfs_next_leaf() doesn't get the path for writing. We can forgo the fancy
606 struct btrfs_path *path, in modify_free_space_bitmap() argument
628 ret = btrfs_search_prev_slot(trans, root, &key, path, 0, 1); in modify_free_space_bitmap()
632 prev_bit = free_space_test_bit(block_group, path, prev_block); in modify_free_space_bitmap()
635 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in modify_free_space_bitmap()
637 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
646 ret = btrfs_search_prev_slot(trans, root, &key, path, 0, 1); in modify_free_space_bitmap()
660 free_space_set_bits(trans, block_group, path, &cur_start, &cur_size, in modify_free_space_bitmap()
664 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
675 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in modify_free_space_bitmap()
677 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
682 next_bit = free_space_test_bit(block_group, path, end); in modify_free_space_bitmap()
709 btrfs_release_path(path); in modify_free_space_bitmap()
710 ret = update_free_space_extent_count(trans, block_group, path, in modify_free_space_bitmap()
719 struct btrfs_path *path, in remove_free_space_extent() argument
733 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in remove_free_space_extent()
737 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in remove_free_space_extent()
765 ret = btrfs_del_item(trans, root, path); in remove_free_space_extent()
775 btrfs_release_path(path); in remove_free_space_extent()
776 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in remove_free_space_extent()
788 btrfs_release_path(path); in remove_free_space_extent()
789 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in remove_free_space_extent()
795 btrfs_release_path(path); in remove_free_space_extent()
796 ret = update_free_space_extent_count(trans, block_group, path, in remove_free_space_extent()
806 struct btrfs_path *path, u64 start, u64 size) in __remove_from_free_space_tree() argument
813 ret = __add_block_group_free_space(trans, block_group, path); in __remove_from_free_space_tree()
818 info = search_free_space_info(NULL, block_group, path, 0); in __remove_from_free_space_tree()
821 flags = btrfs_free_space_flags(path->nodes[0], info); in __remove_from_free_space_tree()
822 btrfs_release_path(path); in __remove_from_free_space_tree()
825 return modify_free_space_bitmap(trans, block_group, path, in __remove_from_free_space_tree()
828 return remove_free_space_extent(trans, block_group, path, in __remove_from_free_space_tree()
837 struct btrfs_path *path; in remove_from_free_space_tree() local
843 path = btrfs_alloc_path(); in remove_from_free_space_tree()
844 if (!path) { in remove_from_free_space_tree()
857 ret = __remove_from_free_space_tree(trans, block_group, path, start, in remove_from_free_space_tree()
863 btrfs_free_path(path); in remove_from_free_space_tree()
871 struct btrfs_path *path, in add_free_space_extent() argument
910 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in add_free_space_extent()
914 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in add_free_space_extent()
918 btrfs_release_path(path); in add_free_space_extent()
933 ret = btrfs_del_item(trans, root, path); in add_free_space_extent()
940 btrfs_release_path(path); in add_free_space_extent()
950 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in add_free_space_extent()
954 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in add_free_space_extent()
958 btrfs_release_path(path); in add_free_space_extent()
974 ret = btrfs_del_item(trans, root, path); in add_free_space_extent()
980 btrfs_release_path(path); in add_free_space_extent()
984 ret = btrfs_insert_empty_item(trans, root, path, &new_key, 0); in add_free_space_extent()
988 btrfs_release_path(path); in add_free_space_extent()
989 ret = update_free_space_extent_count(trans, block_group, path, in add_free_space_extent()
999 struct btrfs_path *path, u64 start, u64 size) in __add_to_free_space_tree() argument
1006 ret = __add_block_group_free_space(trans, block_group, path); in __add_to_free_space_tree()
1011 info = search_free_space_info(NULL, block_group, path, 0); in __add_to_free_space_tree()
1014 flags = btrfs_free_space_flags(path->nodes[0], info); in __add_to_free_space_tree()
1015 btrfs_release_path(path); in __add_to_free_space_tree()
1018 return modify_free_space_bitmap(trans, block_group, path, in __add_to_free_space_tree()
1021 return add_free_space_extent(trans, block_group, path, start, in __add_to_free_space_tree()
1030 struct btrfs_path *path; in add_to_free_space_tree() local
1036 path = btrfs_alloc_path(); in add_to_free_space_tree()
1037 if (!path) { in add_to_free_space_tree()
1050 ret = __add_to_free_space_tree(trans, block_group, path, start, size); in add_to_free_space_tree()
1055 btrfs_free_path(path); in add_to_free_space_tree()
1070 struct btrfs_path *path, *path2; in populate_free_space_tree() local
1075 path = btrfs_alloc_path(); in populate_free_space_tree()
1076 if (!path) in populate_free_space_tree()
1078 path->reada = READA_FORWARD; in populate_free_space_tree()
1082 btrfs_free_path(path); in populate_free_space_tree()
1104 ret = btrfs_search_slot_for_read(extent_root, &key, path, 1, 0); in populate_free_space_tree()
1112 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in populate_free_space_tree()
1138 ret = btrfs_next_item(extent_root, path); in populate_free_space_tree()
1156 btrfs_free_path(path); in populate_free_space_tree()
1225 struct btrfs_path *path; in clear_free_space_tree() local
1230 path = btrfs_alloc_path(); in clear_free_space_tree()
1231 if (!path) in clear_free_space_tree()
1239 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in clear_free_space_tree()
1243 nr = btrfs_header_nritems(path->nodes[0]); in clear_free_space_tree()
1247 path->slots[0] = 0; in clear_free_space_tree()
1248 ret = btrfs_del_items(trans, root, path, 0, nr); in clear_free_space_tree()
1252 btrfs_release_path(path); in clear_free_space_tree()
1257 btrfs_free_path(path); in clear_free_space_tree()
1367 struct btrfs_path *path) in __add_block_group_free_space() argument
1373 ret = add_new_free_space_info(trans, block_group, path); in __add_block_group_free_space()
1377 return __add_to_free_space_tree(trans, block_group, path, in __add_block_group_free_space()
1386 struct btrfs_path *path = NULL; in add_block_group_free_space() local
1396 path = btrfs_alloc_path(); in add_block_group_free_space()
1397 if (!path) { in add_block_group_free_space()
1402 ret = __add_block_group_free_space(trans, block_group, path); in add_block_group_free_space()
1405 btrfs_free_path(path); in add_block_group_free_space()
1416 struct btrfs_path *path; in remove_block_group_free_space() local
1431 path = btrfs_alloc_path(); in remove_block_group_free_space()
1432 if (!path) { in remove_block_group_free_space()
1445 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in remove_block_group_free_space()
1449 leaf = path->nodes[0]; in remove_block_group_free_space()
1451 path->slots[0]++; in remove_block_group_free_space()
1452 while (path->slots[0] > 0) { in remove_block_group_free_space()
1453 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in remove_block_group_free_space()
1460 path->slots[0]--; in remove_block_group_free_space()
1468 path->slots[0]--; in remove_block_group_free_space()
1474 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in remove_block_group_free_space()
1477 btrfs_release_path(path); in remove_block_group_free_space()
1482 btrfs_free_path(path); in remove_block_group_free_space()
1489 struct btrfs_path *path, in load_free_space_bitmaps() argument
1511 ret = btrfs_next_item(root, path); in load_free_space_bitmaps()
1517 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in load_free_space_bitmaps()
1527 bit = free_space_test_bit(block_group, path, offset); in load_free_space_bitmaps()
1573 struct btrfs_path *path, in load_free_space_extents() argument
1594 ret = btrfs_next_item(root, path); in load_free_space_extents()
1600 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in load_free_space_extents()
1640 struct btrfs_path *path; in load_free_space_tree() local
1646 path = btrfs_alloc_path(); in load_free_space_tree()
1647 if (!path) in load_free_space_tree()
1654 path->skip_locking = 1; in load_free_space_tree()
1655 path->search_commit_root = 1; in load_free_space_tree()
1656 path->reada = READA_FORWARD; in load_free_space_tree()
1658 info = search_free_space_info(NULL, block_group, path, 0); in load_free_space_tree()
1663 extent_count = btrfs_free_space_extent_count(path->nodes[0], info); in load_free_space_tree()
1664 flags = btrfs_free_space_flags(path->nodes[0], info); in load_free_space_tree()
1667 * We left path pointing to the free space info item, so now in load_free_space_tree()
1672 ret = load_free_space_bitmaps(caching_ctl, path, extent_count); in load_free_space_tree()
1674 ret = load_free_space_extents(caching_ctl, path, extent_count); in load_free_space_tree()
1677 btrfs_free_path(path); in load_free_space_tree()