diff --git a/check/main.c b/check/main.c index b074e7a5..d5761c47 100644 --- a/check/main.c +++ b/check/main.c @@ -9096,7 +9096,7 @@ static struct extent_buffer *btrfs_fsck_clear_root( if (!path) return ERR_PTR(-ENOMEM); - c = btrfs_alloc_free_block(trans, gfs_info->tree_root, + c = btrfs_alloc_tree_block(trans, gfs_info->tree_root, gfs_info->nodesize, key->objectid, &disk_key, 0, 0, 0); if (IS_ERR(c)) { diff --git a/cmds/rescue-chunk-recover.c b/cmds/rescue-chunk-recover.c index 21417a77..a69913f2 100644 --- a/cmds/rescue-chunk-recover.c +++ b/cmds/rescue-chunk-recover.c @@ -1146,7 +1146,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans, btrfs_set_disk_key_type(&disk_key, BTRFS_DEV_ITEM_KEY); btrfs_set_disk_key_offset(&disk_key, min_devid); - cow = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize, + cow = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize, BTRFS_CHUNK_TREE_OBJECTID, &disk_key, 0, 0, 0); btrfs_set_header_bytenr(cow, cow->start); diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c index cfbcc689..230dae1b 100644 --- a/kernel-shared/ctree.c +++ b/kernel-shared/ctree.c @@ -167,7 +167,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, btrfs_item_key(buf, &disk_key, 0); else btrfs_node_key(buf, &disk_key, 0); - cow = btrfs_alloc_free_block(trans, new_root, buf->len, + cow = btrfs_alloc_tree_block(trans, new_root, buf->len, new_root_objectid, &disk_key, level, buf->start, 0); if (IS_ERR(cow)) { @@ -230,7 +230,7 @@ int btrfs_create_root(struct btrfs_trans_handle *trans, new_root->root_key.type = BTRFS_ROOT_ITEM_KEY; new_root->root_key.offset = 0; - node = btrfs_alloc_free_block(trans, new_root, fs_info->nodesize, + node = btrfs_alloc_tree_block(trans, new_root, fs_info->nodesize, objectid, &disk_key, 0, 0, 0); if (IS_ERR(node)) { ret = PTR_ERR(node); @@ -285,7 +285,7 @@ int btrfs_create_root(struct btrfs_trans_handle *trans, /* * Essential trees can't be created by this function, yet. * As we expect such skeleton exists, or a lot of functions like - * btrfs_alloc_free_block() doesn't work at all + * btrfs_alloc_tree_block() doesn't work at all */ case BTRFS_ROOT_TREE_OBJECTID: case BTRFS_EXTENT_TREE_OBJECTID: @@ -461,7 +461,7 @@ int __btrfs_cow_block(struct btrfs_trans_handle *trans, else btrfs_node_key(buf, &disk_key, 0); - cow = btrfs_alloc_free_block(trans, root, buf->len, + cow = btrfs_alloc_tree_block(trans, root, buf->len, root->root_key.objectid, &disk_key, level, search_start, empty_size); if (IS_ERR(cow)) @@ -1732,7 +1732,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans, else btrfs_node_key(lower, &lower_key, 0); - c = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize, + c = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize, root->root_key.objectid, &lower_key, level, root->node->start, 0); @@ -1858,7 +1858,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root mid = (c_nritems + 1) / 2; btrfs_node_key(c, &disk_key, mid); - split = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize, + split = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize, root->root_key.objectid, &disk_key, level, c->start, 0); if (IS_ERR(split)) @@ -2425,7 +2425,7 @@ again: else btrfs_item_key(l, &disk_key, mid); - right = btrfs_alloc_free_block(trans, root, root->fs_info->nodesize, + right = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize, root->root_key.objectid, &disk_key, 0, l->start, 0); if (IS_ERR(right)) { diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h index ea9a248d..3282bb7c 100644 --- a/kernel-shared/ctree.h +++ b/kernel-shared/ctree.h @@ -849,7 +849,7 @@ struct btrfs_block_group *btrfs_lookup_block_group(struct btrfs_fs_info *info, struct btrfs_block_group *btrfs_lookup_first_block_group(struct btrfs_fs_info *info, u64 bytenr); -struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, +struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, u32 blocksize, u64 root_objectid, struct btrfs_disk_key *key, int level, diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c index 44462d8f..6f9dc327 100644 --- a/kernel-shared/disk-io.c +++ b/kernel-shared/disk-io.c @@ -2333,7 +2333,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, btrfs_setup_root(root, fs_info, key->objectid); memcpy(&root->root_key, key, sizeof(struct btrfs_key)); - leaf = btrfs_alloc_free_block(trans, root, fs_info->nodesize, + leaf = btrfs_alloc_tree_block(trans, root, fs_info->nodesize, root->root_key.objectid, NULL, 0, 0, 0); if (IS_ERR(leaf)) { ret = PTR_ERR(leaf); diff --git a/kernel-shared/extent-tree.c b/kernel-shared/extent-tree.c index 6f6e03c8..27793ab1 100644 --- a/kernel-shared/extent-tree.c +++ b/kernel-shared/extent-tree.c @@ -2554,7 +2554,7 @@ static int alloc_tree_block(struct btrfs_trans_handle *trans, * helper function to allocate a block for a given tree * returns the tree buffer or NULL. */ -struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, +struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, u32 blocksize, u64 root_objectid, struct btrfs_disk_key *key, int level,