btrfs: move root node locking helpers to locking.c
David Sterba
maintainerPATCH 1/1 btrfs: move root node locking helpers to locking.c
The helpers are related to locking so move them there, update comments.
Signed-off-by David Sterba <[email protected]>
--- fs/btrfs/ctree.c | 38 -------------------------------------- fs/btrfs/locking.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 38 deletions(-)
fs/btrfs/ctree.c +0 -38
@@ -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.
fs/btrfs/locking.c +42 -0
45 lines not on this page · raw message
Signature · 1 line
2.24.0
Quoted 3 lines · David Sterba
The helpers are related to locking so move them there, update comments.
Signed-off-by David Sterba <[email protected]>
Reviewed-by Anand Jain <[email protected]>
Quoted 3 lines · David Sterba
The helpers are related to locking so move them there, update comments.
Signed-off-by David Sterba <[email protected]>
Reviewed-by Josef Bacik <[email protected]>
Thanks,
Josef