diff options
author | Josef Bacik <josef@toxicpanda.com> | 2024-04-13 00:07:06 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-05-07 21:31:05 +0200 |
commit | efc7d5dbf8b42eb53db31443520e979b05cd1908 (patch) | |
tree | 048cd4b46c0b04cf1c01ec38c063f8cd51cc649e /fs/btrfs/backref.c | |
parent | 44cc2e38e67b7b7551e923571ef6ea51f3ae1e05 (diff) |
btrfs: stop referencing btrfs_delayed_tree_ref directly
We only ever need to use this to get the level of the tree block ref, so
use the btrfs_delayed_ref_owner() helper, which returns the level for
the given reference.
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/backref.c')
-rw-r--r-- | fs/btrfs/backref.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 06849122a022..5bb71dd1ab2a 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -919,28 +919,29 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info, switch (node->type) { case BTRFS_TREE_BLOCK_REF_KEY: { /* NORMAL INDIRECT METADATA backref */ - struct btrfs_delayed_tree_ref *ref; struct btrfs_key *key_ptr = NULL; + /* The owner of a tree block ref is the level. */ + int level = btrfs_delayed_ref_owner(node); if (head->extent_op && head->extent_op->update_key) { btrfs_disk_key_to_cpu(&key, &head->extent_op->key); key_ptr = &key; } - ref = btrfs_delayed_node_to_tree_ref(node); ret = add_indirect_ref(fs_info, preftrees, node->ref_root, - key_ptr, ref->level + 1, - node->bytenr, count, sc, - GFP_ATOMIC); + key_ptr, level + 1, node->bytenr, + count, sc, GFP_ATOMIC); break; } case BTRFS_SHARED_BLOCK_REF_KEY: { - /* SHARED DIRECT METADATA backref */ - struct btrfs_delayed_tree_ref *ref; - - ref = btrfs_delayed_node_to_tree_ref(node); + /* + * SHARED DIRECT METADATA backref + * + * The owner of a tree block ref is the level. + */ + int level = btrfs_delayed_ref_owner(node); - ret = add_direct_ref(fs_info, preftrees, ref->level + 1, + ret = add_direct_ref(fs_info, preftrees, level + 1, node->parent, node->bytenr, count, sc, GFP_ATOMIC); break; |