aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2024-04-15 16:16:23 -0400
committerDavid Sterba <dsterba@suse.com>2024-05-07 21:31:06 +0200
commite094f48040cda67622060857ad43dad9e418fbd7 (patch)
tree3ec00cdc01ff8d9ab4fb8edf2a62bab09245f3b7 /fs/btrfs/file.c
parent53e24158684b527d013b5b2204ccb34d1f94c248 (diff)
btrfs: change root->root_key.objectid to btrfs_root_id()
A comment from Filipe on one of my previous cleanups brought my attention to a new helper we have for getting the root id of a root, which makes it easier to read in the code. The changes where made with the following Coccinelle semantic patch: // <smpl> @@ expression E,E1; @@ ( E->root_key.objectid = E1 | - E->root_key.objectid + btrfs_root_id(E) ) // </smpl> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> [ minor style fixups ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 065658f2c061..0c7c1b42028e 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -245,7 +245,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
if (args->start >= inode->disk_i_size && !args->replace_extent)
modify_tree = 0;
- update_refs = (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID);
+ update_refs = (btrfs_root_id(root) != BTRFS_TREE_LOG_OBJECTID);
while (1) {
recow = 0;
ret = btrfs_lookup_file_extent(trans, root, path, ino,
@@ -377,8 +377,8 @@ next_slot:
.bytenr = disk_bytenr,
.num_bytes = num_bytes,
.parent = 0,
- .owning_root = root->root_key.objectid,
- .ref_root = root->root_key.objectid,
+ .owning_root = btrfs_root_id(root),
+ .ref_root = btrfs_root_id(root),
};
btrfs_init_data_ref(&ref, new_key.objectid,
args->start - extent_offset,
@@ -470,8 +470,8 @@ delete_extent_item:
.bytenr = disk_bytenr,
.num_bytes = num_bytes,
.parent = 0,
- .owning_root = root->root_key.objectid,
- .ref_root = root->root_key.objectid,
+ .owning_root = btrfs_root_id(root),
+ .ref_root = btrfs_root_id(root),
};
btrfs_init_data_ref(&ref, key.objectid,
key.offset - extent_offset,
@@ -755,8 +755,8 @@ again:
ref.bytenr = bytenr;
ref.num_bytes = num_bytes;
ref.parent = 0;
- ref.owning_root = root->root_key.objectid;
- ref.ref_root = root->root_key.objectid;
+ ref.owning_root = btrfs_root_id(root);
+ ref.ref_root = btrfs_root_id(root);
btrfs_init_data_ref(&ref, ino, orig_offset, 0, false);
ret = btrfs_inc_extent_ref(trans, &ref);
if (ret) {
@@ -785,8 +785,8 @@ again:
ref.bytenr = bytenr;
ref.num_bytes = num_bytes;
ref.parent = 0;
- ref.owning_root = root->root_key.objectid;
- ref.ref_root = root->root_key.objectid;
+ ref.owning_root = btrfs_root_id(root);
+ ref.ref_root = btrfs_root_id(root);
btrfs_init_data_ref(&ref, ino, orig_offset, 0, false);
if (extent_mergeable(leaf, path->slots[0] + 1,
ino, bytenr, orig_offset,
@@ -2493,8 +2493,8 @@ static int btrfs_insert_replace_extent(struct btrfs_trans_handle *trans,
.action = BTRFS_ADD_DELAYED_REF,
.bytenr = extent_info->disk_offset,
.num_bytes = extent_info->disk_len,
- .owning_root = root->root_key.objectid,
- .ref_root = root->root_key.objectid,
+ .owning_root = btrfs_root_id(root),
+ .ref_root = btrfs_root_id(root),
};
u64 ref_offset;