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>
master
Nikolay Borisov 2018-10-01 17:46:17 +03:00 committed by David Sterba
parent 8c028efe4a
commit cb4af7021c
1 changed files with 10 additions and 0 deletions

View File

@ -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);