summaryrefslogtreecommitdiff
path: root/ctree.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 /ctree.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 'ctree.h')
-rw-r--r--ctree.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/ctree.h b/ctree.h
index 49f0f518..a6d6c3de 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1071,6 +1071,17 @@ struct btrfs_block_group_cache {
u64 flags;
int cached;
int ro;
+ /*
+ * If the free space extent count exceeds this number, convert the block
+ * group to bitmaps.
+ */
+ u32 bitmap_high_thresh;
+ /*
+ * If the free space extent count drops below this number, convert the
+ * block group back to extents.
+ */
+ u32 bitmap_low_thresh;
+
};
struct btrfs_device;
@@ -2596,6 +2607,10 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
*root, struct btrfs_key *key, struct btrfs_path *p, int
ins_len, int cow);
+int btrfs_search_slot_for_read(struct btrfs_root *root,
+ const struct btrfs_key *key,
+ struct btrfs_path *p, int find_higher,
+ int return_any);
int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *found_path,
u64 iobjectid, u64 ioff, u8 key_type,
struct btrfs_key *found_key);