From 4d918a7299459174dec85f2056eb11c087dd7dbf Mon Sep 17 00:00:00 2001 From: Nikolay Borisov Date: Fri, 8 Jun 2018 15:47:46 +0300 Subject: btrfs-progs: Add functions to modify the used space by a root Pull the necessary function, excluding locking. Required to enable integration of delayed refs. Signed-off-by: Nikolay Borisov Signed-off-by: David Sterba --- ctree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ctree.c') diff --git a/ctree.c b/ctree.c index 2c51580f..7b74716b 100644 --- a/ctree.c +++ b/ctree.c @@ -76,6 +76,18 @@ void add_root_to_dirty_list(struct btrfs_root *root) } } +static void root_add_used(struct btrfs_root *root, u32 size) +{ + btrfs_set_root_used(&root->root_item, + btrfs_root_used(&root->root_item) + size); +} + +static void root_sub_used(struct btrfs_root *root, u32 size) +{ + btrfs_set_root_used(&root->root_item, + btrfs_root_used(&root->root_item) - size); +} + int btrfs_copy_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct extent_buffer *buf, -- cgit v1.2.3