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 <nbori...@suse.com>
---
 extent-tree.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/extent-tree.c b/extent-tree.c
index b9a30644720b..7adda557f8e6 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,11 @@ 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);
 
-- 
2.7.4

Reply via email to