diff options
author | David Sterba <dsterba@suse.com> | 2020-02-05 17:26:51 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-03-23 17:01:33 +0100 |
commit | b908c334e7a419e5cd08a45d31284b4a93de3bd7 (patch) | |
tree | ef124663d4e50c3190e44d957bac24c0cc49f7ba /fs/btrfs/ctree.c | |
parent | 0024652895e3479cd0d372f63b57d9581a0bdd38 (diff) | |
download | linux-stable-b908c334e7a419e5cd08a45d31284b4a93de3bd7.tar.gz linux-stable-b908c334e7a419e5cd08a45d31284b4a93de3bd7.tar.bz2 linux-stable-b908c334e7a419e5cd08a45d31284b4a93de3bd7.zip |
btrfs: move root node locking helpers to locking.c
The helpers are related to locking so move them there, update comments.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 968faaec0e39..b62721ac5ee8 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -143,44 +143,6 @@ struct extent_buffer *btrfs_root_node(struct btrfs_root *root) return eb; } -/* loop around taking references on and locking the root node of the - * tree until you end up with a lock on the root. A locked buffer - * is returned, with a reference held. - */ -struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root) -{ - struct extent_buffer *eb; - - while (1) { - eb = btrfs_root_node(root); - btrfs_tree_lock(eb); - if (eb == root->node) - break; - btrfs_tree_unlock(eb); - free_extent_buffer(eb); - } - return eb; -} - -/* loop around taking references on and locking the root node of the - * tree until you end up with a lock on the root. A locked buffer - * is returned, with a reference held. - */ -struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root) -{ - struct extent_buffer *eb; - - while (1) { - eb = btrfs_root_node(root); - btrfs_tree_read_lock(eb); - if (eb == root->node) - break; - btrfs_tree_read_unlock(eb); - free_extent_buffer(eb); - } - return eb; -} - /* cowonly root (everything not a reference counted cow subvolume), just get * put onto a simple dirty list. transaction.c walks this to make sure they * get properly updated on disk. |