Lines Matching refs:eb

733 	struct extent_buffer *eb;  in create_reloc_root()  local
751 ret = btrfs_copy_root(trans, root, root->commit_root, &eb, in create_reloc_root()
774 ret = btrfs_copy_root(trans, root, root->node, &eb, in create_reloc_root()
787 btrfs_set_root_bytenr(root_item, eb->start); in create_reloc_root()
788 btrfs_set_root_level(root_item, btrfs_header_level(eb)); in create_reloc_root()
798 btrfs_tree_unlock(eb); in create_reloc_root()
799 free_extent_buffer(eb); in create_reloc_root()
1167 int memcmp_node_keys(struct extent_buffer *eb, int slot, in memcmp_node_keys() argument
1172 btrfs_node_key(eb, &key1, slot); in memcmp_node_keys()
1193 struct extent_buffer *eb; in replace_path() local
1216 eb = btrfs_lock_root_node(dest); in replace_path()
1217 btrfs_set_lock_blocking_write(eb); in replace_path()
1218 level = btrfs_header_level(eb); in replace_path()
1221 btrfs_tree_unlock(eb); in replace_path()
1222 free_extent_buffer(eb); in replace_path()
1227 ret = btrfs_cow_block(trans, dest, eb, NULL, 0, &eb, in replace_path()
1231 btrfs_set_lock_blocking_write(eb); in replace_path()
1239 parent = eb; in replace_path()
1261 eb = path->nodes[level]; in replace_path()
1262 new_bytenr = btrfs_node_blockptr(eb, in replace_path()
1264 new_ptr_gen = btrfs_node_ptr_generation(eb, in replace_path()
1283 eb = read_tree_block(fs_info, old_bytenr, old_ptr_gen, in replace_path()
1285 if (IS_ERR(eb)) { in replace_path()
1286 ret = PTR_ERR(eb); in replace_path()
1288 } else if (!extent_buffer_uptodate(eb)) { in replace_path()
1290 free_extent_buffer(eb); in replace_path()
1293 btrfs_tree_lock(eb); in replace_path()
1295 ret = btrfs_cow_block(trans, dest, eb, parent, in replace_path()
1296 slot, &eb, in replace_path()
1300 btrfs_set_lock_blocking_write(eb); in replace_path()
1305 parent = eb; in replace_path()
1402 struct extent_buffer *eb; in walk_up_reloc_tree() local
1415 eb = path->nodes[i]; in walk_up_reloc_tree()
1416 nritems = btrfs_header_nritems(eb); in walk_up_reloc_tree()
1419 if (btrfs_node_ptr_generation(eb, path->slots[i]) <= in walk_up_reloc_tree()
1440 struct extent_buffer *eb = NULL; in walk_down_reloc_tree() local
1452 eb = path->nodes[i]; in walk_down_reloc_tree()
1453 nritems = btrfs_header_nritems(eb); in walk_down_reloc_tree()
1455 ptr_gen = btrfs_node_ptr_generation(eb, path->slots[i]); in walk_down_reloc_tree()
1471 bytenr = btrfs_node_blockptr(eb, path->slots[i]); in walk_down_reloc_tree()
1472 btrfs_node_key_to_cpu(eb, &first_key, path->slots[i]); in walk_down_reloc_tree()
1473 eb = read_tree_block(fs_info, bytenr, ptr_gen, i - 1, in walk_down_reloc_tree()
1475 if (IS_ERR(eb)) { in walk_down_reloc_tree()
1476 return PTR_ERR(eb); in walk_down_reloc_tree()
1477 } else if (!extent_buffer_uptodate(eb)) { in walk_down_reloc_tree()
1478 free_extent_buffer(eb); in walk_down_reloc_tree()
1481 BUG_ON(btrfs_header_level(eb) != i - 1); in walk_down_reloc_tree()
1482 path->nodes[i - 1] = eb; in walk_down_reloc_tree()
2231 struct extent_buffer *eb; in do_relocation() local
2239 BUG_ON(lowest && node->eb); in do_relocation()
2253 if (upper->eb && !upper->locked) { in do_relocation()
2255 ret = btrfs_bin_search(upper->eb, key, &slot); in do_relocation()
2261 bytenr = btrfs_node_blockptr(upper->eb, slot); in do_relocation()
2262 if (node->eb->start == bytenr) in do_relocation()
2268 if (!upper->eb) { in do_relocation()
2280 if (!upper->eb) { in do_relocation()
2281 upper->eb = path->nodes[upper->level]; in do_relocation()
2284 BUG_ON(upper->eb != path->nodes[upper->level]); in do_relocation()
2293 ret = btrfs_bin_search(upper->eb, key, &slot); in do_relocation()
2301 bytenr = btrfs_node_blockptr(upper->eb, slot); in do_relocation()
2307 upper->eb->start); in do_relocation()
2312 if (node->eb->start == bytenr) in do_relocation()
2317 generation = btrfs_node_ptr_generation(upper->eb, slot); in do_relocation()
2318 btrfs_node_key_to_cpu(upper->eb, &first_key, slot); in do_relocation()
2319 eb = read_tree_block(fs_info, bytenr, generation, in do_relocation()
2321 if (IS_ERR(eb)) { in do_relocation()
2322 err = PTR_ERR(eb); in do_relocation()
2324 } else if (!extent_buffer_uptodate(eb)) { in do_relocation()
2325 free_extent_buffer(eb); in do_relocation()
2329 btrfs_tree_lock(eb); in do_relocation()
2330 btrfs_set_lock_blocking_write(eb); in do_relocation()
2332 if (!node->eb) { in do_relocation()
2333 ret = btrfs_cow_block(trans, root, eb, upper->eb, in do_relocation()
2334 slot, &eb, BTRFS_NESTING_COW); in do_relocation()
2335 btrfs_tree_unlock(eb); in do_relocation()
2336 free_extent_buffer(eb); in do_relocation()
2341 BUG_ON(node->eb != eb); in do_relocation()
2343 btrfs_set_node_blockptr(upper->eb, slot, in do_relocation()
2344 node->eb->start); in do_relocation()
2345 btrfs_set_node_ptr_generation(upper->eb, slot, in do_relocation()
2347 btrfs_mark_buffer_dirty(upper->eb); in do_relocation()
2350 node->eb->start, blocksize, in do_relocation()
2351 upper->eb->start); in do_relocation()
2354 btrfs_header_owner(upper->eb)); in do_relocation()
2358 ret = btrfs_drop_subtree(trans, root, eb, upper->eb); in do_relocation()
2388 btrfs_node_key_to_cpu(node->eb, &key, 0); in link_to_upper()
2465 struct extent_buffer *eb; in get_tree_block_key() local
2467 eb = read_tree_block(fs_info, block->bytenr, block->key.offset, in get_tree_block_key()
2469 if (IS_ERR(eb)) { in get_tree_block_key()
2470 return PTR_ERR(eb); in get_tree_block_key()
2471 } else if (!extent_buffer_uptodate(eb)) { in get_tree_block_key()
2472 free_extent_buffer(eb); in get_tree_block_key()
2476 btrfs_item_key_to_cpu(eb, &block->key, 0); in get_tree_block_key()
2478 btrfs_node_key_to_cpu(eb, &block->key, 0); in get_tree_block_key()
2479 free_extent_buffer(eb); in get_tree_block_key()
2866 struct extent_buffer *eb; in add_tree_block() local
2875 eb = path->nodes[0]; in add_tree_block()
2876 item_size = btrfs_item_size_nr(eb, path->slots[0]); in add_tree_block()
2880 ei = btrfs_item_ptr(eb, path->slots[0], in add_tree_block()
2884 level = btrfs_tree_block_level(eb, bi); in add_tree_block()
2888 generation = btrfs_extent_generation(eb, ei); in add_tree_block()
2890 btrfs_print_v0_err(eb->fs_info); in add_tree_block()
2891 btrfs_handle_fs_error(eb->fs_info, -EINVAL, NULL); in add_tree_block()
3095 struct extent_buffer *eb; in add_data_references() local
3097 eb = read_tree_block(fs_info, ref_node->val, 0, 0, NULL); in add_data_references()
3098 if (IS_ERR(eb)) { in add_data_references()
3099 ret = PTR_ERR(eb); in add_data_references()
3102 ret = delete_v1_space_cache(eb, rc->block_group, in add_data_references()
3104 free_extent_buffer(eb); in add_data_references()
3982 node->eb = cow; in btrfs_reloc_cow_block()