Lines Matching refs:eb
43 struct extent_buffer *eb);
150 struct extent_buffer *eb; in btrfs_root_node() local
154 eb = rcu_dereference(root->node); in btrfs_root_node()
162 if (atomic_inc_not_zero(&eb->refs)) { in btrfs_root_node()
169 return eb; in btrfs_root_node()
178 struct extent_buffer *eb; in btrfs_lock_root_node() local
181 eb = btrfs_root_node(root); in btrfs_lock_root_node()
182 btrfs_tree_lock(eb); in btrfs_lock_root_node()
183 if (eb == root->node) in btrfs_lock_root_node()
185 btrfs_tree_unlock(eb); in btrfs_lock_root_node()
186 free_extent_buffer(eb); in btrfs_lock_root_node()
188 return eb; in btrfs_lock_root_node()
197 struct extent_buffer *eb; in btrfs_read_lock_root_node() local
200 eb = btrfs_root_node(root); in btrfs_read_lock_root_node()
201 btrfs_tree_read_lock(eb); in btrfs_read_lock_root_node()
202 if (eb == root->node) in btrfs_read_lock_root_node()
204 btrfs_tree_read_unlock(eb); in btrfs_read_lock_root_node()
205 free_extent_buffer(eb); in btrfs_read_lock_root_node()
207 return eb; in btrfs_read_lock_root_node()
463 struct extent_buffer *eb) { in tree_mod_dont_log() argument
467 if (eb && btrfs_header_level(eb) == 0) in tree_mod_dont_log()
481 struct extent_buffer *eb) in tree_mod_need_log() argument
486 if (eb && btrfs_header_level(eb) == 0) in tree_mod_need_log()
493 alloc_tree_mod_elem(struct extent_buffer *eb, int slot, in alloc_tree_mod_elem() argument
502 tm->index = eb->start >> PAGE_CACHE_SHIFT; in alloc_tree_mod_elem()
504 btrfs_node_key(eb, &tm->key, slot); in alloc_tree_mod_elem()
505 tm->blockptr = btrfs_node_blockptr(eb, slot); in alloc_tree_mod_elem()
509 tm->generation = btrfs_node_ptr_generation(eb, slot); in alloc_tree_mod_elem()
517 struct extent_buffer *eb, int slot, in tree_mod_log_insert_key() argument
523 if (!tree_mod_need_log(fs_info, eb)) in tree_mod_log_insert_key()
526 tm = alloc_tree_mod_elem(eb, slot, op, flags); in tree_mod_log_insert_key()
530 if (tree_mod_dont_log(fs_info, eb)) { in tree_mod_log_insert_key()
536 write_unlock(&eb->fs_info->tree_mod_log_lock); in tree_mod_log_insert_key()
545 struct extent_buffer *eb, int dst_slot, int src_slot, in tree_mod_log_insert_move() argument
554 if (!tree_mod_need_log(fs_info, eb)) in tree_mod_log_insert_move()
567 tm->index = eb->start >> PAGE_CACHE_SHIFT; in tree_mod_log_insert_move()
574 tm_list[i] = alloc_tree_mod_elem(eb, i + dst_slot, in tree_mod_log_insert_move()
582 if (tree_mod_dont_log(fs_info, eb)) in tree_mod_log_insert_move()
600 write_unlock(&eb->fs_info->tree_mod_log_lock); in tree_mod_log_insert_move()
611 write_unlock(&eb->fs_info->tree_mod_log_lock); in tree_mod_log_insert_move()
859 struct extent_buffer *eb, int slot, int atomic) in tree_mod_log_set_node_key() argument
863 ret = tree_mod_log_insert_key(fs_info, eb, slot, in tree_mod_log_set_node_key()
870 tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb) in tree_mod_log_free_eb() argument
877 if (btrfs_header_level(eb) == 0) in tree_mod_log_free_eb()
883 nritems = btrfs_header_nritems(eb); in tree_mod_log_free_eb()
889 tm_list[i] = alloc_tree_mod_elem(eb, i, in tree_mod_log_free_eb()
897 if (tree_mod_dont_log(fs_info, eb)) in tree_mod_log_free_eb()
901 write_unlock(&eb->fs_info->tree_mod_log_lock); in tree_mod_log_free_eb()
1258 __tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, in __tree_mod_log_rewind() argument
1268 n = btrfs_header_nritems(eb); in __tree_mod_log_rewind()
1282 btrfs_set_node_key(eb, &tm->key, tm->slot); in __tree_mod_log_rewind()
1283 btrfs_set_node_blockptr(eb, tm->slot, tm->blockptr); in __tree_mod_log_rewind()
1284 btrfs_set_node_ptr_generation(eb, tm->slot, in __tree_mod_log_rewind()
1290 btrfs_set_node_key(eb, &tm->key, tm->slot); in __tree_mod_log_rewind()
1291 btrfs_set_node_blockptr(eb, tm->slot, tm->blockptr); in __tree_mod_log_rewind()
1292 btrfs_set_node_ptr_generation(eb, tm->slot, in __tree_mod_log_rewind()
1302 memmove_extent_buffer(eb, o_dst, o_src, in __tree_mod_log_rewind()
1325 btrfs_set_header_nritems(eb, n); in __tree_mod_log_rewind()
1337 struct extent_buffer *eb, u64 time_seq) in tree_mod_log_rewind() argument
1343 return eb; in tree_mod_log_rewind()
1345 if (btrfs_header_level(eb) == 0) in tree_mod_log_rewind()
1346 return eb; in tree_mod_log_rewind()
1348 tm = tree_mod_log_search(fs_info, eb->start, time_seq); in tree_mod_log_rewind()
1350 return eb; in tree_mod_log_rewind()
1353 btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); in tree_mod_log_rewind()
1357 eb_rewin = alloc_dummy_extent_buffer(fs_info, eb->start); in tree_mod_log_rewind()
1359 btrfs_tree_read_unlock_blocking(eb); in tree_mod_log_rewind()
1360 free_extent_buffer(eb); in tree_mod_log_rewind()
1363 btrfs_set_header_bytenr(eb_rewin, eb->start); in tree_mod_log_rewind()
1365 btrfs_header_backref_rev(eb)); in tree_mod_log_rewind()
1366 btrfs_set_header_owner(eb_rewin, btrfs_header_owner(eb)); in tree_mod_log_rewind()
1367 btrfs_set_header_level(eb_rewin, btrfs_header_level(eb)); in tree_mod_log_rewind()
1369 eb_rewin = btrfs_clone_extent_buffer(eb); in tree_mod_log_rewind()
1371 btrfs_tree_read_unlock_blocking(eb); in tree_mod_log_rewind()
1372 free_extent_buffer(eb); in tree_mod_log_rewind()
1378 btrfs_tree_read_unlock_blocking(eb); in tree_mod_log_rewind()
1379 free_extent_buffer(eb); in tree_mod_log_rewind()
1402 struct extent_buffer *eb = NULL; in get_old_root() local
1435 eb = btrfs_clone_extent_buffer(old); in get_old_root()
1443 eb = alloc_dummy_extent_buffer(root->fs_info, logical); in get_old_root()
1446 eb = btrfs_clone_extent_buffer(eb_root); in get_old_root()
1451 if (!eb) in get_old_root()
1454 btrfs_set_header_bytenr(eb, eb->start); in get_old_root()
1455 btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV); in get_old_root()
1456 btrfs_set_header_owner(eb, eb_root_owner); in get_old_root()
1457 btrfs_set_header_level(eb, old_root->level); in get_old_root()
1458 btrfs_set_header_generation(eb, old_generation); in get_old_root()
1460 btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb, in get_old_root()
1461 btrfs_header_level(eb)); in get_old_root()
1462 btrfs_tree_read_lock(eb); in get_old_root()
1464 __tree_mod_log_rewind(root->fs_info, eb, time_seq, tm); in get_old_root()
1466 WARN_ON(btrfs_header_level(eb) != 0); in get_old_root()
1467 WARN_ON(btrfs_header_nritems(eb) > BTRFS_NODEPTRS_PER_BLOCK(root)); in get_old_root()
1469 return eb; in get_old_root()
1728 static noinline int generic_bin_search(struct extent_buffer *eb, in generic_bin_search() argument
1753 err = map_private_extent_buffer(eb, offset, in generic_bin_search()
1761 read_extent_buffer(eb, &unaligned, in generic_bin_search()
1789 static int bin_search(struct extent_buffer *eb, struct btrfs_key *key, in bin_search() argument
1793 return generic_bin_search(eb, in bin_search()
1796 key, btrfs_header_nritems(eb), in bin_search()
1799 return generic_bin_search(eb, in bin_search()
1802 key, btrfs_header_nritems(eb), in bin_search()
1806 int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, in btrfs_bin_search() argument
1809 return bin_search(eb, key, level, slot); in btrfs_bin_search()
1836 struct extent_buffer *eb; in read_node_slot() local
1845 eb = read_tree_block(root, btrfs_node_blockptr(parent, slot), in read_node_slot()
1847 if (IS_ERR(eb) || !extent_buffer_uptodate(eb)) { in read_node_slot()
1848 if (!IS_ERR(eb)) in read_node_slot()
1849 free_extent_buffer(eb); in read_node_slot()
1850 eb = NULL; in read_node_slot()
1853 return eb; in read_node_slot()
2227 struct extent_buffer *eb; in reada_for_search() local
2242 eb = btrfs_find_tree_block(root->fs_info, search); in reada_for_search()
2243 if (eb) { in reada_for_search()
2244 free_extent_buffer(eb); in reada_for_search()
2287 struct extent_buffer *eb; in reada_for_balance() local
2302 eb = btrfs_find_tree_block(root->fs_info, block1); in reada_for_balance()
2308 if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) in reada_for_balance()
2310 free_extent_buffer(eb); in reada_for_balance()
2315 eb = btrfs_find_tree_block(root->fs_info, block2); in reada_for_balance()
2316 if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) in reada_for_balance()
2318 free_extent_buffer(eb); in reada_for_balance()
2603 struct extent_buffer *eb; in btrfs_find_item() local
2616 eb = path->nodes[0]; in btrfs_find_item()
2617 if (ret && path->slots[0] >= btrfs_header_nritems(eb)) { in btrfs_find_item()
2621 eb = path->nodes[0]; in btrfs_find_item()
2624 btrfs_item_key_to_cpu(eb, found_key, path->slots[0]); in btrfs_find_item()
3152 struct extent_buffer *eb; in btrfs_set_item_key_safe() local
3155 eb = path->nodes[0]; in btrfs_set_item_key_safe()
3158 btrfs_item_key(eb, &disk_key, slot - 1); in btrfs_set_item_key_safe()
3161 if (slot < btrfs_header_nritems(eb) - 1) { in btrfs_set_item_key_safe()
3162 btrfs_item_key(eb, &disk_key, slot + 1); in btrfs_set_item_key_safe()
3167 btrfs_set_item_key(eb, &disk_key, slot); in btrfs_set_item_key_safe()
3168 btrfs_mark_buffer_dirty(eb); in btrfs_set_item_key_safe()