mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-26 16:12:34 +00:00
ba01aadff1
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>
23 lines
464 B
C
23 lines
464 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#include "kernel-shared/ctree.h"
|
|
#include "kernel-shared/locking.h"
|
|
|
|
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;
|
|
}
|