Lines Matching refs:eb
53 struct extent_buffer *eb; member
388 btrfs_tree_unlock(node->eb); in unlock_node_buffer()
395 if (node->eb) { in drop_node_buffer()
397 free_extent_buffer(node->eb); in drop_node_buffer()
398 node->eb = NULL; in drop_node_buffer()
657 struct extent_buffer *eb; in build_backref_tree() local
738 eb = path1->nodes[0]; in build_backref_tree()
741 if (path1->slots[0] >= btrfs_header_nritems(eb)) { in build_backref_tree()
749 eb = path1->nodes[0]; in build_backref_tree()
752 btrfs_item_key_to_cpu(eb, &key, path1->slots[0]); in build_backref_tree()
760 ret = find_inline_backref(eb, path1->slots[0], in build_backref_tree()
772 type = btrfs_get_extent_inline_ref_type(eb, iref, in build_backref_tree()
779 key.offset = btrfs_extent_inline_ref_offset(eb, iref); in build_backref_tree()
892 eb = path2->nodes[level]; in build_backref_tree()
893 if (btrfs_node_blockptr(eb, path2->slots[level]) != in build_backref_tree()
925 eb = path2->nodes[level]; in build_backref_tree()
926 rb_node = tree_search(&cache->rb_root, eb->start); in build_backref_tree()
934 upper->bytenr = eb->start; in build_backref_tree()
935 upper->owner = btrfs_header_owner(eb); in build_backref_tree()
945 if (btrfs_block_can_be_shared(root, eb)) in build_backref_tree()
971 upper->owner = btrfs_header_owner(eb); in build_backref_tree()
1356 struct extent_buffer *eb; in create_reloc_root() local
1372 ret = btrfs_copy_root(trans, root, root->commit_root, &eb, in create_reloc_root()
1393 ret = btrfs_copy_root(trans, root, root->node, &eb, in create_reloc_root()
1399 btrfs_set_root_bytenr(root_item, eb->start); in create_reloc_root()
1400 btrfs_set_root_level(root_item, btrfs_header_level(eb)); in create_reloc_root()
1410 btrfs_tree_unlock(eb); in create_reloc_root()
1411 free_extent_buffer(eb); in create_reloc_root()
1747 int memcmp_node_keys(struct extent_buffer *eb, int slot, in memcmp_node_keys() argument
1752 btrfs_node_key(eb, &key1, slot); in memcmp_node_keys()
1773 struct extent_buffer *eb; in replace_path() local
1796 eb = btrfs_lock_root_node(dest); in replace_path()
1797 btrfs_set_lock_blocking_write(eb); in replace_path()
1798 level = btrfs_header_level(eb); in replace_path()
1801 btrfs_tree_unlock(eb); in replace_path()
1802 free_extent_buffer(eb); in replace_path()
1807 ret = btrfs_cow_block(trans, dest, eb, NULL, 0, &eb); in replace_path()
1810 btrfs_set_lock_blocking_write(eb); in replace_path()
1818 parent = eb; in replace_path()
1840 eb = path->nodes[level]; in replace_path()
1841 new_bytenr = btrfs_node_blockptr(eb, in replace_path()
1843 new_ptr_gen = btrfs_node_ptr_generation(eb, in replace_path()
1862 eb = read_tree_block(fs_info, old_bytenr, old_ptr_gen, in replace_path()
1864 if (IS_ERR(eb)) { in replace_path()
1865 ret = PTR_ERR(eb); in replace_path()
1867 } else if (!extent_buffer_uptodate(eb)) { in replace_path()
1869 free_extent_buffer(eb); in replace_path()
1872 btrfs_tree_lock(eb); in replace_path()
1874 ret = btrfs_cow_block(trans, dest, eb, parent, in replace_path()
1875 slot, &eb); in replace_path()
1878 btrfs_set_lock_blocking_write(eb); in replace_path()
1883 parent = eb; in replace_path()
1980 struct extent_buffer *eb; in walk_up_reloc_tree() local
1993 eb = path->nodes[i]; in walk_up_reloc_tree()
1994 nritems = btrfs_header_nritems(eb); in walk_up_reloc_tree()
1997 if (btrfs_node_ptr_generation(eb, path->slots[i]) <= in walk_up_reloc_tree()
2018 struct extent_buffer *eb = NULL; in walk_down_reloc_tree() local
2030 eb = path->nodes[i]; in walk_down_reloc_tree()
2031 nritems = btrfs_header_nritems(eb); in walk_down_reloc_tree()
2033 ptr_gen = btrfs_node_ptr_generation(eb, path->slots[i]); in walk_down_reloc_tree()
2049 bytenr = btrfs_node_blockptr(eb, path->slots[i]); in walk_down_reloc_tree()
2050 btrfs_node_key_to_cpu(eb, &first_key, path->slots[i]); in walk_down_reloc_tree()
2051 eb = read_tree_block(fs_info, bytenr, ptr_gen, i - 1, in walk_down_reloc_tree()
2053 if (IS_ERR(eb)) { in walk_down_reloc_tree()
2054 return PTR_ERR(eb); in walk_down_reloc_tree()
2055 } else if (!extent_buffer_uptodate(eb)) { in walk_down_reloc_tree()
2056 free_extent_buffer(eb); in walk_down_reloc_tree()
2059 BUG_ON(btrfs_header_level(eb) != i - 1); in walk_down_reloc_tree()
2060 path->nodes[i - 1] = eb; in walk_down_reloc_tree()
2746 struct extent_buffer *eb; in do_relocation() local
2754 BUG_ON(lowest && node->eb); in do_relocation()
2768 if (upper->eb && !upper->locked) { in do_relocation()
2770 ret = btrfs_bin_search(upper->eb, key, in do_relocation()
2777 bytenr = btrfs_node_blockptr(upper->eb, slot); in do_relocation()
2778 if (node->eb->start == bytenr) in do_relocation()
2784 if (!upper->eb) { in do_relocation()
2796 if (!upper->eb) { in do_relocation()
2797 upper->eb = path->nodes[upper->level]; in do_relocation()
2800 BUG_ON(upper->eb != path->nodes[upper->level]); in do_relocation()
2809 ret = btrfs_bin_search(upper->eb, key, upper->level, in do_relocation()
2818 bytenr = btrfs_node_blockptr(upper->eb, slot); in do_relocation()
2824 upper->eb->start); in do_relocation()
2829 if (node->eb->start == bytenr) in do_relocation()
2834 generation = btrfs_node_ptr_generation(upper->eb, slot); in do_relocation()
2835 btrfs_node_key_to_cpu(upper->eb, &first_key, slot); in do_relocation()
2836 eb = read_tree_block(fs_info, bytenr, generation, in do_relocation()
2838 if (IS_ERR(eb)) { in do_relocation()
2839 err = PTR_ERR(eb); in do_relocation()
2841 } else if (!extent_buffer_uptodate(eb)) { in do_relocation()
2842 free_extent_buffer(eb); in do_relocation()
2846 btrfs_tree_lock(eb); in do_relocation()
2847 btrfs_set_lock_blocking_write(eb); in do_relocation()
2849 if (!node->eb) { in do_relocation()
2850 ret = btrfs_cow_block(trans, root, eb, upper->eb, in do_relocation()
2851 slot, &eb); in do_relocation()
2852 btrfs_tree_unlock(eb); in do_relocation()
2853 free_extent_buffer(eb); in do_relocation()
2858 BUG_ON(node->eb != eb); in do_relocation()
2860 btrfs_set_node_blockptr(upper->eb, slot, in do_relocation()
2861 node->eb->start); in do_relocation()
2862 btrfs_set_node_ptr_generation(upper->eb, slot, in do_relocation()
2864 btrfs_mark_buffer_dirty(upper->eb); in do_relocation()
2867 node->eb->start, blocksize, in do_relocation()
2868 upper->eb->start); in do_relocation()
2871 btrfs_header_owner(upper->eb)); in do_relocation()
2875 ret = btrfs_drop_subtree(trans, root, eb, upper->eb); in do_relocation()
2905 btrfs_node_key_to_cpu(node->eb, &key, 0); in link_to_upper()
3001 struct extent_buffer *eb; in get_tree_block_key() local
3004 eb = read_tree_block(fs_info, block->bytenr, block->key.offset, in get_tree_block_key()
3006 if (IS_ERR(eb)) { in get_tree_block_key()
3007 return PTR_ERR(eb); in get_tree_block_key()
3008 } else if (!extent_buffer_uptodate(eb)) { in get_tree_block_key()
3009 free_extent_buffer(eb); in get_tree_block_key()
3013 btrfs_item_key_to_cpu(eb, &block->key, 0); in get_tree_block_key()
3015 btrfs_node_key_to_cpu(eb, &block->key, 0); in get_tree_block_key()
3016 free_extent_buffer(eb); in get_tree_block_key()
3396 struct extent_buffer *eb; in add_tree_block() local
3405 eb = path->nodes[0]; in add_tree_block()
3406 item_size = btrfs_item_size_nr(eb, path->slots[0]); in add_tree_block()
3410 ei = btrfs_item_ptr(eb, path->slots[0], in add_tree_block()
3414 level = btrfs_tree_block_level(eb, bi); in add_tree_block()
3418 generation = btrfs_extent_generation(eb, ei); in add_tree_block()
3420 btrfs_print_v0_err(eb->fs_info); in add_tree_block()
3421 btrfs_handle_fs_error(eb->fs_info, -EINVAL, NULL); in add_tree_block()
3525 struct extent_buffer *eb) in block_use_full_backref() argument
3530 if (btrfs_header_flag(eb, BTRFS_HEADER_FLAG_RELOC) || in block_use_full_backref()
3531 btrfs_header_backref_rev(eb) < BTRFS_MIXED_BACKREF_REV) in block_use_full_backref()
3535 eb->start, btrfs_header_level(eb), 1, in block_use_full_backref()
3767 struct extent_buffer *eb; in add_data_references() local
3776 eb = path->nodes[0]; in add_data_references()
3777 ptr = btrfs_item_ptr_offset(eb, path->slots[0]); in add_data_references()
3778 end = ptr + btrfs_item_size_nr(eb, path->slots[0]); in add_data_references()
3783 key.type = btrfs_get_extent_inline_ref_type(eb, iref, in add_data_references()
3786 key.offset = btrfs_extent_inline_ref_offset(eb, iref); in add_data_references()
3792 eb, dref, blocks); in add_data_references()
3797 eb->start, path->slots[0]); in add_data_references()
3809 eb = path->nodes[0]; in add_data_references()
3810 if (path->slots[0] >= btrfs_header_nritems(eb)) { in add_data_references()
3818 eb = path->nodes[0]; in add_data_references()
3821 btrfs_item_key_to_cpu(eb, &key, path->slots[0]); in add_data_references()
3829 dref = btrfs_item_ptr(eb, path->slots[0], in add_data_references()
3832 eb, dref, blocks); in add_data_references()
3834 btrfs_print_v0_err(eb->fs_info); in add_data_references()
3835 btrfs_handle_fs_error(eb->fs_info, -EINVAL, NULL); in add_data_references()
4692 node->eb = cow; in btrfs_reloc_cow_block()