@@ -9098,7 +9098,7 @@ static struct extent_buffer *btrfs_fsck_clear_root(
c = btrfs_alloc_tree_block(trans, gfs_info->tree_root,
gfs_info->nodesize, key->objectid,
- &disk_key, 0, 0, 0);
+ &disk_key, 0, 0, 0, BTRFS_NESTING_NORMAL);
if (IS_ERR(c)) {
btrfs_free_path(path);
return c;
@@ -1148,7 +1148,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans,
cow = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize,
BTRFS_CHUNK_TREE_OBJECTID,
- &disk_key, 0, 0, 0);
+ &disk_key, 0, 0, 0, BTRFS_NESTING_NORMAL);
btrfs_set_header_bytenr(cow, cow->start);
btrfs_set_header_generation(cow, trans->transid);
btrfs_set_header_nritems(cow, 0);
@@ -169,7 +169,8 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
btrfs_node_key(buf, &disk_key, 0);
cow = btrfs_alloc_tree_block(trans, new_root, buf->len,
new_root_objectid, &disk_key,
- level, buf->start, 0);
+ level, buf->start, 0,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(cow)) {
kfree(new_root);
return PTR_ERR(cow);
@@ -231,7 +232,8 @@ int btrfs_create_root(struct btrfs_trans_handle *trans,
new_root->root_key.offset = 0;
node = btrfs_alloc_tree_block(trans, new_root, fs_info->nodesize,
- objectid, &disk_key, 0, 0, 0);
+ objectid, &disk_key, 0, 0, 0,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(node)) {
ret = PTR_ERR(node);
error("failed to create root node for tree %llu: %d (%m)",
@@ -463,7 +465,8 @@ int __btrfs_cow_block(struct btrfs_trans_handle *trans,
cow = btrfs_alloc_tree_block(trans, root, buf->len,
root->root_key.objectid, &disk_key,
- level, search_start, empty_size);
+ level, search_start, empty_size,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(cow))
return PTR_ERR(cow);
@@ -1734,7 +1737,8 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
c = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize,
root->root_key.objectid, &lower_key,
- level, root->node->start, 0);
+ level, root->node->start, 0,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(c))
return PTR_ERR(c);
@@ -1860,7 +1864,8 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
split = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize,
root->root_key.objectid,
- &disk_key, level, c->start, 0);
+ &disk_key, level, c->start, 0,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(split))
return PTR_ERR(split);
@@ -2427,7 +2432,8 @@ again:
right = btrfs_alloc_tree_block(trans, root, root->fs_info->nodesize,
root->root_key.objectid,
- &disk_key, 0, l->start, 0);
+ &disk_key, 0, l->start, 0,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(right)) {
BUG_ON(1);
return PTR_ERR(right);
@@ -29,6 +29,7 @@
#include "kernel-shared/uapi/btrfs_tree.h"
#include "accessors.h"
#include "extent-io-tree.h"
+#include "locking.h"
struct btrfs_root;
struct btrfs_trans_handle;
@@ -853,7 +854,8 @@ 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,
- u64 hint, u64 empty_size);
+ u64 hint, u64 empty_size,
+ enum btrfs_lock_nesting nest);
int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 offset, int metadata, u64 *refs, u64 *flags);
@@ -2334,7 +2334,8 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
memcpy(&root->root_key, key, sizeof(struct btrfs_key));
leaf = btrfs_alloc_tree_block(trans, root, fs_info->nodesize,
- root->root_key.objectid, NULL, 0, 0, 0);
+ root->root_key.objectid, NULL, 0, 0, 0,
+ BTRFS_NESTING_NORMAL);
if (IS_ERR(leaf)) {
ret = PTR_ERR(leaf);
leaf = NULL;
@@ -2559,7 +2559,8 @@ 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,
- u64 hint, u64 empty_size)
+ u64 hint, u64 empty_size,
+ enum btrfs_lock_nesting nest)
{
struct btrfs_key ins;
int ret;
This is how btrfs_alloc_tree_block is defined in the kernel, so when we go to sync this code in it'll be easier if we're already setup to accept this argument. Since we're in progs we don't care about nesting so just use BTRFS_NORMAL_NESTING everywhere, as we sync in the kernel code it'll get updated to whatever is appropriate. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- check/main.c | 2 +- cmds/rescue-chunk-recover.c | 2 +- kernel-shared/ctree.c | 18 ++++++++++++------ kernel-shared/ctree.h | 4 +++- kernel-shared/disk-io.c | 3 ++- kernel-shared/extent-tree.c | 3 ++- 6 files changed, 21 insertions(+), 11 deletions(-)