1
2
3
4
5
6 #ifndef BTRFS_FREE_SPACE_TREE_H
7 #define BTRFS_FREE_SPACE_TREE_H
8
9 struct btrfs_caching_control;
10
11
12
13
14
15
16 #define BTRFS_FREE_SPACE_BITMAP_SIZE 256
17 #define BTRFS_FREE_SPACE_BITMAP_BITS (BTRFS_FREE_SPACE_BITMAP_SIZE * BITS_PER_BYTE)
18
19 void set_free_space_tree_thresholds(struct btrfs_block_group_cache *block_group);
20 int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info);
21 int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info);
22 int load_free_space_tree(struct btrfs_caching_control *caching_ctl);
23 int add_block_group_free_space(struct btrfs_trans_handle *trans,
24 struct btrfs_block_group_cache *block_group);
25 int remove_block_group_free_space(struct btrfs_trans_handle *trans,
26 struct btrfs_block_group_cache *block_group);
27 int add_to_free_space_tree(struct btrfs_trans_handle *trans,
28 u64 start, u64 size);
29 int remove_from_free_space_tree(struct btrfs_trans_handle *trans,
30 u64 start, u64 size);
31
32 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
33 struct btrfs_free_space_info *
34 search_free_space_info(struct btrfs_trans_handle *trans,
35 struct btrfs_block_group_cache *block_group,
36 struct btrfs_path *path, int cow);
37 int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
38 struct btrfs_block_group_cache *block_group,
39 struct btrfs_path *path, u64 start, u64 size);
40 int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
41 struct btrfs_block_group_cache *block_group,
42 struct btrfs_path *path, u64 start, u64 size);
43 int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
44 struct btrfs_block_group_cache *block_group,
45 struct btrfs_path *path);
46 int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
47 struct btrfs_block_group_cache *block_group,
48 struct btrfs_path *path);
49 int free_space_test_bit(struct btrfs_block_group_cache *block_group,
50 struct btrfs_path *path, u64 offset);
51 #endif
52
53 #endif