btrfs-progs: take a ref in the root locking code

This code in the kernel not only returns the locked root, but also takes
a reference on the node.  This is important for when we sync ctree.c
into btrfs-progs, it expects that references are held on the root node
after calling these helpers.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-08-23 10:27:48 -04:00 committed by David Sterba
parent ce93d20fd5
commit ba01aadff1

View File

@ -5,15 +5,18 @@
struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root)
{
root->node->refs++;
return root->node;
}
struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root)
{
root->node->refs++;
return root->node;
}
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root)
{
root->node->refs++;
return root->node;
}