summaryrefslogtreecommitdiff
path: root/extent-tree.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-10-01 17:46:17 +0300
committerDavid Sterba <dsterba@suse.com>2018-10-25 16:11:39 +0200
commitcb4af7021c0c8495b1824785012d8796d63e2d20 (patch)
tree21f9c6d8fe54906dcd5272e1ca973e56c3154da7 /extent-tree.c
parent8c028efe4a31e15c0d106daf6218dedc373273c6 (diff)
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 <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r--extent-tree.c10
1 files changed, 10 insertions, 0 deletions
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);