From cb4af7021c0c8495b1824785012d8796d63e2d20 Mon Sep 17 00:00:00 2001 From: Nikolay Borisov Date: Mon, 1 Oct 2018 17:46:17 +0300 Subject: btrfs-progs: Hook FST code in extent (de)alloc For now this doesn't change the functionality since FST code is not yet enabled via the compat bits. But this will be needed when it's enabled so that the FST is correctly modified during repair operations that allocate/deallocate extents. Signed-off-by: Nikolay Borisov Signed-off-by: David Sterba --- extent-tree.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index de48cbcd..cd986339 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -29,6 +29,7 @@ #include "crc32c.h" #include "volumes.h" #include "free-space-cache.h" +#include "free-space-tree.h" #include "utils.h" #define PENDING_EXTENT_INSERT 0 @@ -2276,6 +2277,11 @@ static int __free_extent(struct btrfs_trans_handle *trans, BUG_ON(ret); } + ret = add_to_free_space_tree(trans, bytenr, num_bytes); + if (ret) { + goto fail; + } + update_block_group(trans->fs_info, bytenr, num_bytes, 0, mark_free); } @@ -2595,6 +2601,10 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans, btrfs_mark_buffer_dirty(leaf); btrfs_free_path(path); + ret = remove_from_free_space_tree(trans, ins.objectid, fs_info->nodesize); + if (ret) + return ret; + ret = update_block_group(fs_info, ins.objectid, fs_info->nodesize, 1, 0); -- cgit v1.2.3