summaryrefslogtreecommitdiff
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2024-04-12 19:37:53 -0400
committerDavid Sterba <dsterba@suse.com>2024-05-07 21:31:04 +0200
commitf2e69a77aa5150d8a8ea13e45aad6dc42e581591 (patch)
tree390183cf4617a22e4807ac9b1ffb692295f92093 /fs/btrfs/relocation.c
parent4d09b4e942bce27c6fa66f3582dc639417107e2d (diff)
btrfs: move ref_root into btrfs_ref
We have this in both btrfs_tree_ref and btrfs_data_ref, which is just wasting space and making the code more complicated. Move this into btrfs_ref proper and update all the call sites to do the assignment in btrfs_ref. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index fdcecce85f91..085b2b616569 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1109,8 +1109,8 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
ref.len = num_bytes;
ref.parent = parent;
ref.owning_root = root->root_key.objectid;
- btrfs_init_data_ref(&ref, btrfs_header_owner(leaf),
- key.objectid, key.offset,
+ ref.ref_root = btrfs_header_owner(leaf);
+ btrfs_init_data_ref(&ref, key.objectid, key.offset,
root->root_key.objectid, false);
ret = btrfs_inc_extent_ref(trans, &ref);
if (ret) {
@@ -1123,8 +1123,8 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
ref.len = num_bytes;
ref.parent = parent;
ref.owning_root = root->root_key.objectid;
- btrfs_init_data_ref(&ref, btrfs_header_owner(leaf),
- key.objectid, key.offset,
+ ref.ref_root = btrfs_header_owner(leaf);
+ btrfs_init_data_ref(&ref, key.objectid, key.offset,
root->root_key.objectid, false);
ret = btrfs_free_extent(trans, &ref);
if (ret) {
@@ -1339,8 +1339,8 @@ again:
ref.len = blocksize;
ref.parent = path->nodes[level]->start;
ref.owning_root = src->root_key.objectid;
- btrfs_init_tree_ref(&ref, level - 1, src->root_key.objectid,
- 0, true);
+ ref.ref_root = src->root_key.objectid;
+ btrfs_init_tree_ref(&ref, level - 1, 0, true);
ret = btrfs_inc_extent_ref(trans, &ref);
if (ret) {
btrfs_abort_transaction(trans, ret);
@@ -1352,8 +1352,8 @@ again:
ref.len = blocksize;
ref.parent = 0;
ref.owning_root = dest->root_key.objectid;
- btrfs_init_tree_ref(&ref, level - 1, dest->root_key.objectid, 0,
- true);
+ ref.ref_root = dest->root_key.objectid;
+ btrfs_init_tree_ref(&ref, level - 1, 0, true);
ret = btrfs_inc_extent_ref(trans, &ref);
if (ret) {
btrfs_abort_transaction(trans, ret);
@@ -1366,8 +1366,8 @@ again:
ref.len = blocksize;
ref.parent = path->nodes[level]->start;
ref.owning_root = 0;
- btrfs_init_tree_ref(&ref, level - 1, src->root_key.objectid,
- 0, true);
+ ref.ref_root = src->root_key.objectid;
+ btrfs_init_tree_ref(&ref, level - 1, 0, true);
ret = btrfs_free_extent(trans, &ref);
if (ret) {
btrfs_abort_transaction(trans, ret);
@@ -1380,8 +1380,8 @@ again:
ref.len = blocksize;
ref.parent = 0;
ref.owning_root = 0;
- btrfs_init_tree_ref(&ref, level - 1, dest->root_key.objectid,
- 0, true);
+ ref.ref_root = dest->root_key.objectid;
+ btrfs_init_tree_ref(&ref, level - 1, 0, true);
ret = btrfs_free_extent(trans, &ref);
if (ret) {
btrfs_abort_transaction(trans, ret);
@@ -2485,6 +2485,7 @@ static int do_relocation(struct btrfs_trans_handle *trans,
.len = blocksize,
.parent = upper->eb->start,
.owning_root = btrfs_header_owner(upper->eb),
+ .ref_root = btrfs_header_owner(upper->eb),
};
btrfs_set_node_blockptr(upper->eb, slot,
@@ -2494,7 +2495,6 @@ static int do_relocation(struct btrfs_trans_handle *trans,
btrfs_mark_buffer_dirty(trans, upper->eb);
btrfs_init_tree_ref(&ref, node->level,
- btrfs_header_owner(upper->eb),
root->root_key.objectid, false);
ret = btrfs_inc_extent_ref(trans, &ref);
if (!ret)