summaryrefslogtreecommitdiff
path: root/free-space-tree.h
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-10-01 17:46:16 +0300
committerDavid Sterba <dsterba@suse.com>2018-10-25 16:11:39 +0200
commit8c028efe4a31e15c0d106daf6218dedc373273c6 (patch)
tree58d6efe31920b5112e8b6c4ab5bdcaf334b09626 /free-space-tree.h
parenta9ce9286f24b299ea2a8465d89cee659c3f5dcf1 (diff)
btrfs-progs: Pull free space tree related code from kernel
To help implement free space tree checker in user space some kernel function are necessary, namely iterating/deleting/adding freespace items, some internal search functions. Functions to populate a block group based on the extent tree. The code is largely copy/paste from the kernel with locking eliminated (i.e free_space_lock). It supports reading/writing of both bitmap and extent based FST trees. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'free-space-tree.h')
-rw-r--r--free-space-tree.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/free-space-tree.h b/free-space-tree.h
index 4845f13..1af12a8 100644
--- a/free-space-tree.h
+++ b/free-space-tree.h
@@ -19,8 +19,20 @@
#ifndef __BTRFS_FREE_SPACE_TREE_H__
#define __BTRFS_FREE_SPACE_TREE_H__
+#define BTRFS_FREE_SPACE_BITMAP_SIZE 256
+#define BTRFS_FREE_SPACE_BITMAP_BITS (BTRFS_FREE_SPACE_BITMAP_SIZE * BITS_PER_BYTE)
+
int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info);
int load_free_space_tree(struct btrfs_fs_info *fs_info,
struct btrfs_block_group_cache *block_group);
+int populate_free_space_tree(struct btrfs_trans_handle *trans,
+ struct btrfs_block_group_cache *block_group);
+int remove_block_group_free_space(struct btrfs_trans_handle *trans,
+ struct btrfs_block_group_cache *block_group);
+int add_to_free_space_tree(struct btrfs_trans_handle *trans, u64 start,
+ u64 size);
+int remove_from_free_space_tree(struct btrfs_trans_handle *trans, u64 start,
+ u64 size);
+int btrfs_create_free_space_tree(struct btrfs_fs_info *info);
#endif