Lines Matching refs:path
17 struct btrfs_path *path);
49 struct btrfs_path *path) in add_new_free_space_info() argument
61 ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*info)); in add_new_free_space_info()
65 leaf = path->nodes[0]; in add_new_free_space_info()
66 info = btrfs_item_ptr(leaf, path->slots[0], in add_new_free_space_info()
74 btrfs_release_path(path); in add_new_free_space_info()
82 struct btrfs_path *path, int cow) in search_free_space_info() argument
93 ret = btrfs_search_slot(trans, root, &key, path, 0, cow); in search_free_space_info()
103 return btrfs_item_ptr(path->nodes[0], path->slots[0], in search_free_space_info()
184 struct btrfs_path *path) in convert_free_space_to_bitmaps() argument
216 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in convert_free_space_to_bitmaps()
220 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
222 path->slots[0]++; in convert_free_space_to_bitmaps()
223 while (path->slots[0] > 0) { in convert_free_space_to_bitmaps()
224 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in convert_free_space_to_bitmaps()
246 path->slots[0]--; in convert_free_space_to_bitmaps()
252 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in convert_free_space_to_bitmaps()
255 btrfs_release_path(path); in convert_free_space_to_bitmaps()
258 info = search_free_space_info(trans, block_group, path, 1); in convert_free_space_to_bitmaps()
263 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
269 btrfs_release_path(path); in convert_free_space_to_bitmaps()
297 ret = btrfs_insert_empty_item(trans, root, path, &key, in convert_free_space_to_bitmaps()
302 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
303 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in convert_free_space_to_bitmaps()
307 btrfs_release_path(path); in convert_free_space_to_bitmaps()
324 struct btrfs_path *path) in convert_free_space_to_extents() argument
355 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in convert_free_space_to_extents()
359 leaf = path->nodes[0]; in convert_free_space_to_extents()
361 path->slots[0]++; in convert_free_space_to_extents()
362 while (path->slots[0] > 0) { in convert_free_space_to_extents()
363 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in convert_free_space_to_extents()
386 ptr = btrfs_item_ptr_offset(leaf, path->slots[0] - 1); in convert_free_space_to_extents()
391 path->slots[0]--; in convert_free_space_to_extents()
397 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in convert_free_space_to_extents()
400 btrfs_release_path(path); in convert_free_space_to_extents()
403 info = search_free_space_info(trans, block_group, path, 1); in convert_free_space_to_extents()
408 leaf = path->nodes[0]; in convert_free_space_to_extents()
414 btrfs_release_path(path); in convert_free_space_to_extents()
427 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in convert_free_space_to_extents()
430 btrfs_release_path(path); in convert_free_space_to_extents()
457 struct btrfs_path *path, in update_free_space_extent_count() argument
468 info = search_free_space_info(trans, block_group, path, 1); in update_free_space_extent_count()
473 flags = btrfs_free_space_flags(path->nodes[0], info); in update_free_space_extent_count()
474 extent_count = btrfs_free_space_extent_count(path->nodes[0], info); in update_free_space_extent_count()
477 btrfs_set_free_space_extent_count(path->nodes[0], info, extent_count); in update_free_space_extent_count()
478 btrfs_mark_buffer_dirty(path->nodes[0]); in update_free_space_extent_count()
479 btrfs_release_path(path); in update_free_space_extent_count()
483 ret = convert_free_space_to_bitmaps(trans, block_group, path); in update_free_space_extent_count()
486 ret = convert_free_space_to_extents(trans, block_group, path); in update_free_space_extent_count()
495 struct btrfs_path *path, u64 offset) in free_space_test_bit() argument
502 leaf = path->nodes[0]; in free_space_test_bit()
503 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in free_space_test_bit()
510 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in free_space_test_bit()
517 struct btrfs_path *path, u64 *start, u64 *size, in free_space_set_bits() argument
527 leaf = path->nodes[0]; in free_space_set_bits()
528 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in free_space_set_bits()
539 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in free_space_set_bits()
585 struct btrfs_path *path, in modify_free_space_bitmap() argument
607 ret = btrfs_search_prev_slot(trans, root, &key, path, 0, 1); in modify_free_space_bitmap()
611 prev_bit = free_space_test_bit(block_group, path, prev_block); in modify_free_space_bitmap()
614 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in modify_free_space_bitmap()
616 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
625 ret = btrfs_search_prev_slot(trans, root, &key, path, 0, 1); in modify_free_space_bitmap()
639 free_space_set_bits(block_group, path, &cur_start, &cur_size, in modify_free_space_bitmap()
643 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
654 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in modify_free_space_bitmap()
656 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
661 next_bit = free_space_test_bit(block_group, path, end); in modify_free_space_bitmap()
688 btrfs_release_path(path); in modify_free_space_bitmap()
689 ret = update_free_space_extent_count(trans, block_group, path, in modify_free_space_bitmap()
698 struct btrfs_path *path, in remove_free_space_extent() argument
712 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in remove_free_space_extent()
716 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in remove_free_space_extent()
744 ret = btrfs_del_item(trans, root, path); in remove_free_space_extent()
754 btrfs_release_path(path); in remove_free_space_extent()
755 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in remove_free_space_extent()
767 btrfs_release_path(path); in remove_free_space_extent()
768 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in remove_free_space_extent()
774 btrfs_release_path(path); in remove_free_space_extent()
775 ret = update_free_space_extent_count(trans, block_group, path, in remove_free_space_extent()
785 struct btrfs_path *path, u64 start, u64 size) in __remove_from_free_space_tree() argument
792 ret = __add_block_group_free_space(trans, block_group, path); in __remove_from_free_space_tree()
797 info = search_free_space_info(NULL, block_group, path, 0); in __remove_from_free_space_tree()
800 flags = btrfs_free_space_flags(path->nodes[0], info); in __remove_from_free_space_tree()
801 btrfs_release_path(path); in __remove_from_free_space_tree()
804 return modify_free_space_bitmap(trans, block_group, path, in __remove_from_free_space_tree()
807 return remove_free_space_extent(trans, block_group, path, in __remove_from_free_space_tree()
816 struct btrfs_path *path; in remove_from_free_space_tree() local
822 path = btrfs_alloc_path(); in remove_from_free_space_tree()
823 if (!path) { in remove_from_free_space_tree()
836 ret = __remove_from_free_space_tree(trans, block_group, path, start, in remove_from_free_space_tree()
842 btrfs_free_path(path); in remove_from_free_space_tree()
850 struct btrfs_path *path, in add_free_space_extent() argument
889 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in add_free_space_extent()
893 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in add_free_space_extent()
897 btrfs_release_path(path); in add_free_space_extent()
912 ret = btrfs_del_item(trans, root, path); in add_free_space_extent()
919 btrfs_release_path(path); in add_free_space_extent()
929 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in add_free_space_extent()
933 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in add_free_space_extent()
937 btrfs_release_path(path); in add_free_space_extent()
953 ret = btrfs_del_item(trans, root, path); in add_free_space_extent()
959 btrfs_release_path(path); in add_free_space_extent()
963 ret = btrfs_insert_empty_item(trans, root, path, &new_key, 0); in add_free_space_extent()
967 btrfs_release_path(path); in add_free_space_extent()
968 ret = update_free_space_extent_count(trans, block_group, path, in add_free_space_extent()
978 struct btrfs_path *path, u64 start, u64 size) in __add_to_free_space_tree() argument
985 ret = __add_block_group_free_space(trans, block_group, path); in __add_to_free_space_tree()
990 info = search_free_space_info(NULL, block_group, path, 0); in __add_to_free_space_tree()
993 flags = btrfs_free_space_flags(path->nodes[0], info); in __add_to_free_space_tree()
994 btrfs_release_path(path); in __add_to_free_space_tree()
997 return modify_free_space_bitmap(trans, block_group, path, in __add_to_free_space_tree()
1000 return add_free_space_extent(trans, block_group, path, start, in __add_to_free_space_tree()
1009 struct btrfs_path *path; in add_to_free_space_tree() local
1015 path = btrfs_alloc_path(); in add_to_free_space_tree()
1016 if (!path) { in add_to_free_space_tree()
1029 ret = __add_to_free_space_tree(trans, block_group, path, start, size); in add_to_free_space_tree()
1034 btrfs_free_path(path); in add_to_free_space_tree()
1049 struct btrfs_path *path, *path2; in populate_free_space_tree() local
1054 path = btrfs_alloc_path(); in populate_free_space_tree()
1055 if (!path) in populate_free_space_tree()
1057 path->reada = READA_FORWARD; in populate_free_space_tree()
1061 btrfs_free_path(path); in populate_free_space_tree()
1082 ret = btrfs_search_slot_for_read(extent_root, &key, path, 1, 0); in populate_free_space_tree()
1090 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in populate_free_space_tree()
1116 ret = btrfs_next_item(extent_root, path); in populate_free_space_tree()
1134 btrfs_free_path(path); in populate_free_space_tree()
1186 struct btrfs_path *path; in clear_free_space_tree() local
1191 path = btrfs_alloc_path(); in clear_free_space_tree()
1192 if (!path) in clear_free_space_tree()
1195 path->leave_spinning = 1; in clear_free_space_tree()
1202 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in clear_free_space_tree()
1206 nr = btrfs_header_nritems(path->nodes[0]); in clear_free_space_tree()
1210 path->slots[0] = 0; in clear_free_space_tree()
1211 ret = btrfs_del_items(trans, root, path, 0, nr); in clear_free_space_tree()
1215 btrfs_release_path(path); in clear_free_space_tree()
1220 btrfs_free_path(path); in clear_free_space_tree()
1269 struct btrfs_path *path) in __add_block_group_free_space() argument
1275 ret = add_new_free_space_info(trans, block_group, path); in __add_block_group_free_space()
1279 return __add_to_free_space_tree(trans, block_group, path, in __add_block_group_free_space()
1288 struct btrfs_path *path = NULL; in add_block_group_free_space() local
1298 path = btrfs_alloc_path(); in add_block_group_free_space()
1299 if (!path) { in add_block_group_free_space()
1304 ret = __add_block_group_free_space(trans, block_group, path); in add_block_group_free_space()
1307 btrfs_free_path(path); in add_block_group_free_space()
1318 struct btrfs_path *path; in remove_block_group_free_space() local
1333 path = btrfs_alloc_path(); in remove_block_group_free_space()
1334 if (!path) { in remove_block_group_free_space()
1347 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in remove_block_group_free_space()
1351 leaf = path->nodes[0]; in remove_block_group_free_space()
1353 path->slots[0]++; in remove_block_group_free_space()
1354 while (path->slots[0] > 0) { in remove_block_group_free_space()
1355 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in remove_block_group_free_space()
1362 path->slots[0]--; in remove_block_group_free_space()
1370 path->slots[0]--; in remove_block_group_free_space()
1376 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in remove_block_group_free_space()
1379 btrfs_release_path(path); in remove_block_group_free_space()
1384 btrfs_free_path(path); in remove_block_group_free_space()
1391 struct btrfs_path *path, in load_free_space_bitmaps() argument
1413 ret = btrfs_next_item(root, path); in load_free_space_bitmaps()
1419 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in load_free_space_bitmaps()
1431 bit = free_space_test_bit(block_group, path, offset); in load_free_space_bitmaps()
1472 struct btrfs_path *path, in load_free_space_extents() argument
1491 ret = btrfs_next_item(root, path); in load_free_space_extents()
1497 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in load_free_space_extents()
1537 struct btrfs_path *path; in load_free_space_tree() local
1543 path = btrfs_alloc_path(); in load_free_space_tree()
1544 if (!path) in load_free_space_tree()
1551 path->skip_locking = 1; in load_free_space_tree()
1552 path->search_commit_root = 1; in load_free_space_tree()
1553 path->reada = READA_FORWARD; in load_free_space_tree()
1555 info = search_free_space_info(NULL, block_group, path, 0); in load_free_space_tree()
1560 extent_count = btrfs_free_space_extent_count(path->nodes[0], info); in load_free_space_tree()
1561 flags = btrfs_free_space_flags(path->nodes[0], info); in load_free_space_tree()
1569 ret = load_free_space_bitmaps(caching_ctl, path, extent_count); in load_free_space_tree()
1571 ret = load_free_space_extents(caching_ctl, path, extent_count); in load_free_space_tree()
1574 btrfs_free_path(path); in load_free_space_tree()