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 <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Nikolay Borisov 2018-06-08 15:47:46 +03:00 committed by David Sterba
parent dddc3f44c9
commit 4d918a7299
1 changed files with 12 additions and 0 deletions

12
ctree.c
View File

@ -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,