|
@@ -2177,10 +2177,11 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
|
|
|
|
|
|
/* Can return -ENOMEM */
|
|
|
int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
|
|
|
- struct btrfs_fs_info *fs_info,
|
|
|
+ struct btrfs_root *root,
|
|
|
u64 bytenr, u64 num_bytes, u64 parent,
|
|
|
u64 root_objectid, u64 owner, u64 offset)
|
|
|
{
|
|
|
+ struct btrfs_fs_info *fs_info = root->fs_info;
|
|
|
int old_ref_mod, new_ref_mod;
|
|
|
int ret;
|
|
|
|
|
@@ -3339,7 +3340,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
|
|
int level;
|
|
|
int ret = 0;
|
|
|
int (*process_func)(struct btrfs_trans_handle *,
|
|
|
- struct btrfs_fs_info *,
|
|
|
+ struct btrfs_root *,
|
|
|
u64, u64, u64, u64, u64, u64);
|
|
|
|
|
|
|
|
@@ -3379,7 +3380,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
|
|
|
|
|
num_bytes = btrfs_file_extent_disk_num_bytes(buf, fi);
|
|
|
key.offset -= btrfs_file_extent_offset(buf, fi);
|
|
|
- ret = process_func(trans, fs_info, bytenr, num_bytes,
|
|
|
+ ret = process_func(trans, root, bytenr, num_bytes,
|
|
|
parent, ref_root, key.objectid,
|
|
|
key.offset);
|
|
|
if (ret)
|
|
@@ -3387,7 +3388,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
|
|
} else {
|
|
|
bytenr = btrfs_node_blockptr(buf, i);
|
|
|
num_bytes = fs_info->nodesize;
|
|
|
- ret = process_func(trans, fs_info, bytenr, num_bytes,
|
|
|
+ ret = process_func(trans, root, bytenr, num_bytes,
|
|
|
parent, ref_root, level - 1, 0);
|
|
|
if (ret)
|
|
|
goto fail;
|
|
@@ -7331,17 +7332,17 @@ out:
|
|
|
|
|
|
/* Can return -ENOMEM */
|
|
|
int btrfs_free_extent(struct btrfs_trans_handle *trans,
|
|
|
- struct btrfs_fs_info *fs_info,
|
|
|
+ struct btrfs_root *root,
|
|
|
u64 bytenr, u64 num_bytes, u64 parent, u64 root_objectid,
|
|
|
u64 owner, u64 offset)
|
|
|
{
|
|
|
+ struct btrfs_fs_info *fs_info = root->fs_info;
|
|
|
int old_ref_mod, new_ref_mod;
|
|
|
int ret;
|
|
|
|
|
|
if (btrfs_is_testing(fs_info))
|
|
|
return 0;
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
* tree log blocks never actually go into the extent allocation
|
|
|
* tree, just update pinning info and exit early.
|
|
@@ -8308,17 +8309,18 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
|
|
|
}
|
|
|
|
|
|
int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
|
|
|
- u64 root_objectid, u64 owner,
|
|
|
+ struct btrfs_root *root, u64 owner,
|
|
|
u64 offset, u64 ram_bytes,
|
|
|
struct btrfs_key *ins)
|
|
|
{
|
|
|
- struct btrfs_fs_info *fs_info = trans->fs_info;
|
|
|
+ struct btrfs_fs_info *fs_info = root->fs_info;
|
|
|
int ret;
|
|
|
|
|
|
- BUG_ON(root_objectid == BTRFS_TREE_LOG_OBJECTID);
|
|
|
+ BUG_ON(root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID);
|
|
|
|
|
|
ret = btrfs_add_delayed_data_ref(fs_info, trans, ins->objectid,
|
|
|
- ins->offset, 0, root_objectid, owner,
|
|
|
+ ins->offset, 0,
|
|
|
+ root->root_key.objectid, owner,
|
|
|
offset, ram_bytes,
|
|
|
BTRFS_ADD_DELAYED_EXTENT, NULL, NULL);
|
|
|
return ret;
|
|
@@ -8896,7 +8898,7 @@ skip:
|
|
|
ret);
|
|
|
}
|
|
|
}
|
|
|
- ret = btrfs_free_extent(trans, fs_info, bytenr, blocksize,
|
|
|
+ ret = btrfs_free_extent(trans, root, bytenr, blocksize,
|
|
|
parent, root->root_key.objectid,
|
|
|
level - 1, 0);
|
|
|
if (ret)
|