Lines Matching full:path
17 struct btrfs_path *path);
66 struct btrfs_path *path) in add_new_free_space_info() argument
78 ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*info)); in add_new_free_space_info()
82 leaf = path->nodes[0]; in add_new_free_space_info()
83 info = btrfs_item_ptr(leaf, path->slots[0], in add_new_free_space_info()
91 btrfs_release_path(path); in add_new_free_space_info()
99 struct btrfs_path *path, int cow) in search_free_space_info() argument
110 ret = btrfs_search_slot(trans, root, &key, path, 0, cow); in search_free_space_info()
120 return btrfs_item_ptr(path->nodes[0], path->slots[0], in search_free_space_info()
202 struct btrfs_path *path) in convert_free_space_to_bitmaps() argument
233 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in convert_free_space_to_bitmaps()
237 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
239 path->slots[0]++; in convert_free_space_to_bitmaps()
240 while (path->slots[0] > 0) { in convert_free_space_to_bitmaps()
241 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in convert_free_space_to_bitmaps()
263 path->slots[0]--; in convert_free_space_to_bitmaps()
269 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in convert_free_space_to_bitmaps()
272 btrfs_release_path(path); in convert_free_space_to_bitmaps()
275 info = search_free_space_info(trans, block_group, path, 1); in convert_free_space_to_bitmaps()
280 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
286 btrfs_release_path(path); in convert_free_space_to_bitmaps()
313 ret = btrfs_insert_empty_item(trans, root, path, &key, in convert_free_space_to_bitmaps()
318 leaf = path->nodes[0]; in convert_free_space_to_bitmaps()
319 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in convert_free_space_to_bitmaps()
323 btrfs_release_path(path); in convert_free_space_to_bitmaps()
340 struct btrfs_path *path) in convert_free_space_to_extents() argument
370 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in convert_free_space_to_extents()
374 leaf = path->nodes[0]; in convert_free_space_to_extents()
376 path->slots[0]++; in convert_free_space_to_extents()
377 while (path->slots[0] > 0) { in convert_free_space_to_extents()
378 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in convert_free_space_to_extents()
401 ptr = btrfs_item_ptr_offset(leaf, path->slots[0] - 1); in convert_free_space_to_extents()
406 path->slots[0]--; in convert_free_space_to_extents()
412 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in convert_free_space_to_extents()
415 btrfs_release_path(path); in convert_free_space_to_extents()
418 info = search_free_space_info(trans, block_group, path, 1); in convert_free_space_to_extents()
423 leaf = path->nodes[0]; in convert_free_space_to_extents()
429 btrfs_release_path(path); in convert_free_space_to_extents()
442 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in convert_free_space_to_extents()
445 btrfs_release_path(path); in convert_free_space_to_extents()
472 struct btrfs_path *path, in update_free_space_extent_count() argument
483 info = search_free_space_info(trans, block_group, path, 1); in update_free_space_extent_count()
488 flags = btrfs_free_space_flags(path->nodes[0], info); in update_free_space_extent_count()
489 extent_count = btrfs_free_space_extent_count(path->nodes[0], info); in update_free_space_extent_count()
492 btrfs_set_free_space_extent_count(path->nodes[0], info, extent_count); in update_free_space_extent_count()
493 btrfs_mark_buffer_dirty(path->nodes[0]); in update_free_space_extent_count()
494 btrfs_release_path(path); in update_free_space_extent_count()
498 ret = convert_free_space_to_bitmaps(trans, block_group, path); in update_free_space_extent_count()
501 ret = convert_free_space_to_extents(trans, block_group, path); in update_free_space_extent_count()
510 struct btrfs_path *path, u64 offset) in free_space_test_bit() argument
517 leaf = path->nodes[0]; in free_space_test_bit()
518 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in free_space_test_bit()
525 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in free_space_test_bit()
532 struct btrfs_path *path, u64 *start, u64 *size, in free_space_set_bits() argument
542 leaf = path->nodes[0]; in free_space_set_bits()
543 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in free_space_set_bits()
554 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in free_space_set_bits()
569 * btrfs_next_leaf() doesn't get the path for writing. We can forgo the fancy
600 struct btrfs_path *path, in modify_free_space_bitmap() argument
622 ret = btrfs_search_prev_slot(trans, root, &key, path, 0, 1); in modify_free_space_bitmap()
626 prev_bit = free_space_test_bit(block_group, path, prev_block); in modify_free_space_bitmap()
629 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in modify_free_space_bitmap()
631 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
640 ret = btrfs_search_prev_slot(trans, root, &key, path, 0, 1); in modify_free_space_bitmap()
654 free_space_set_bits(block_group, path, &cur_start, &cur_size, in modify_free_space_bitmap()
658 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
669 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in modify_free_space_bitmap()
671 ret = free_space_next_bitmap(trans, root, path); in modify_free_space_bitmap()
676 next_bit = free_space_test_bit(block_group, path, end); in modify_free_space_bitmap()
703 btrfs_release_path(path); in modify_free_space_bitmap()
704 ret = update_free_space_extent_count(trans, block_group, path, in modify_free_space_bitmap()
713 struct btrfs_path *path, in remove_free_space_extent() argument
727 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in remove_free_space_extent()
731 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in remove_free_space_extent()
759 ret = btrfs_del_item(trans, root, path); in remove_free_space_extent()
769 btrfs_release_path(path); in remove_free_space_extent()
770 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in remove_free_space_extent()
782 btrfs_release_path(path); in remove_free_space_extent()
783 ret = btrfs_insert_empty_item(trans, root, path, &key, 0); in remove_free_space_extent()
789 btrfs_release_path(path); in remove_free_space_extent()
790 ret = update_free_space_extent_count(trans, block_group, path, in remove_free_space_extent()
800 struct btrfs_path *path, u64 start, u64 size) in __remove_from_free_space_tree() argument
807 ret = __add_block_group_free_space(trans, block_group, path); in __remove_from_free_space_tree()
812 info = search_free_space_info(NULL, block_group, path, 0); in __remove_from_free_space_tree()
815 flags = btrfs_free_space_flags(path->nodes[0], info); in __remove_from_free_space_tree()
816 btrfs_release_path(path); in __remove_from_free_space_tree()
819 return modify_free_space_bitmap(trans, block_group, path, in __remove_from_free_space_tree()
822 return remove_free_space_extent(trans, block_group, path, in __remove_from_free_space_tree()
831 struct btrfs_path *path; in remove_from_free_space_tree() local
837 path = btrfs_alloc_path(); in remove_from_free_space_tree()
838 if (!path) { in remove_from_free_space_tree()
851 ret = __remove_from_free_space_tree(trans, block_group, path, start, in remove_from_free_space_tree()
857 btrfs_free_path(path); in remove_from_free_space_tree()
865 struct btrfs_path *path, in add_free_space_extent() argument
904 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in add_free_space_extent()
908 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in add_free_space_extent()
912 btrfs_release_path(path); in add_free_space_extent()
927 ret = btrfs_del_item(trans, root, path); in add_free_space_extent()
934 btrfs_release_path(path); in add_free_space_extent()
944 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in add_free_space_extent()
948 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in add_free_space_extent()
952 btrfs_release_path(path); in add_free_space_extent()
968 ret = btrfs_del_item(trans, root, path); in add_free_space_extent()
974 btrfs_release_path(path); in add_free_space_extent()
978 ret = btrfs_insert_empty_item(trans, root, path, &new_key, 0); in add_free_space_extent()
982 btrfs_release_path(path); in add_free_space_extent()
983 ret = update_free_space_extent_count(trans, block_group, path, in add_free_space_extent()
993 struct btrfs_path *path, u64 start, u64 size) in __add_to_free_space_tree() argument
1000 ret = __add_block_group_free_space(trans, block_group, path); in __add_to_free_space_tree()
1005 info = search_free_space_info(NULL, block_group, path, 0); in __add_to_free_space_tree()
1008 flags = btrfs_free_space_flags(path->nodes[0], info); in __add_to_free_space_tree()
1009 btrfs_release_path(path); in __add_to_free_space_tree()
1012 return modify_free_space_bitmap(trans, block_group, path, in __add_to_free_space_tree()
1015 return add_free_space_extent(trans, block_group, path, start, in __add_to_free_space_tree()
1024 struct btrfs_path *path; in add_to_free_space_tree() local
1030 path = btrfs_alloc_path(); in add_to_free_space_tree()
1031 if (!path) { in add_to_free_space_tree()
1044 ret = __add_to_free_space_tree(trans, block_group, path, start, size); in add_to_free_space_tree()
1049 btrfs_free_path(path); in add_to_free_space_tree()
1064 struct btrfs_path *path, *path2; in populate_free_space_tree() local
1069 path = btrfs_alloc_path(); in populate_free_space_tree()
1070 if (!path) in populate_free_space_tree()
1072 path->reada = READA_FORWARD; in populate_free_space_tree()
1076 btrfs_free_path(path); in populate_free_space_tree()
1098 ret = btrfs_search_slot_for_read(extent_root, &key, path, 1, 0); in populate_free_space_tree()
1106 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in populate_free_space_tree()
1132 ret = btrfs_next_item(extent_root, path); in populate_free_space_tree()
1150 btrfs_free_path(path); in populate_free_space_tree()
1214 struct btrfs_path *path; in clear_free_space_tree() local
1219 path = btrfs_alloc_path(); in clear_free_space_tree()
1220 if (!path) in clear_free_space_tree()
1228 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in clear_free_space_tree()
1232 nr = btrfs_header_nritems(path->nodes[0]); in clear_free_space_tree()
1236 path->slots[0] = 0; in clear_free_space_tree()
1237 ret = btrfs_del_items(trans, root, path, 0, nr); in clear_free_space_tree()
1241 btrfs_release_path(path); in clear_free_space_tree()
1246 btrfs_free_path(path); in clear_free_space_tree()
1298 struct btrfs_path *path) in __add_block_group_free_space() argument
1304 ret = add_new_free_space_info(trans, block_group, path); in __add_block_group_free_space()
1308 return __add_to_free_space_tree(trans, block_group, path, in __add_block_group_free_space()
1317 struct btrfs_path *path = NULL; in add_block_group_free_space() local
1327 path = btrfs_alloc_path(); in add_block_group_free_space()
1328 if (!path) { in add_block_group_free_space()
1333 ret = __add_block_group_free_space(trans, block_group, path); in add_block_group_free_space()
1336 btrfs_free_path(path); in add_block_group_free_space()
1347 struct btrfs_path *path; in remove_block_group_free_space() local
1362 path = btrfs_alloc_path(); in remove_block_group_free_space()
1363 if (!path) { in remove_block_group_free_space()
1376 ret = btrfs_search_prev_slot(trans, root, &key, path, -1, 1); in remove_block_group_free_space()
1380 leaf = path->nodes[0]; in remove_block_group_free_space()
1382 path->slots[0]++; in remove_block_group_free_space()
1383 while (path->slots[0] > 0) { in remove_block_group_free_space()
1384 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0] - 1); in remove_block_group_free_space()
1391 path->slots[0]--; in remove_block_group_free_space()
1399 path->slots[0]--; in remove_block_group_free_space()
1405 ret = btrfs_del_items(trans, root, path, path->slots[0], nr); in remove_block_group_free_space()
1408 btrfs_release_path(path); in remove_block_group_free_space()
1413 btrfs_free_path(path); in remove_block_group_free_space()
1420 struct btrfs_path *path, in load_free_space_bitmaps() argument
1442 ret = btrfs_next_item(root, path); in load_free_space_bitmaps()
1448 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in load_free_space_bitmaps()
1458 bit = free_space_test_bit(block_group, path, offset); in load_free_space_bitmaps()
1497 struct btrfs_path *path, in load_free_space_extents() argument
1516 ret = btrfs_next_item(root, path); in load_free_space_extents()
1522 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); in load_free_space_extents()
1558 struct btrfs_path *path; in load_free_space_tree() local
1564 path = btrfs_alloc_path(); in load_free_space_tree()
1565 if (!path) in load_free_space_tree()
1572 path->skip_locking = 1; in load_free_space_tree()
1573 path->search_commit_root = 1; in load_free_space_tree()
1574 path->reada = READA_FORWARD; in load_free_space_tree()
1576 info = search_free_space_info(NULL, block_group, path, 0); in load_free_space_tree()
1581 extent_count = btrfs_free_space_extent_count(path->nodes[0], info); in load_free_space_tree()
1582 flags = btrfs_free_space_flags(path->nodes[0], info); in load_free_space_tree()
1585 * We left path pointing to the free space info item, so now in load_free_space_tree()
1590 ret = load_free_space_bitmaps(caching_ctl, path, extent_count); in load_free_space_tree()
1592 ret = load_free_space_extents(caching_ctl, path, extent_count); in load_free_space_tree()
1595 btrfs_free_path(path); in load_free_space_tree()