mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
Merge branch 'freespace-tree' into for-linus-4.5
Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
commit
f7d3d2f99e
16 changed files with 2934 additions and 113 deletions
|
@ -42,6 +42,7 @@
|
|||
#include "locking.h"
|
||||
#include "tree-log.h"
|
||||
#include "free-space-cache.h"
|
||||
#include "free-space-tree.h"
|
||||
#include "inode-map.h"
|
||||
#include "check-integrity.h"
|
||||
#include "rcu-string.h"
|
||||
|
@ -1650,6 +1651,9 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
|
|||
if (location->objectid == BTRFS_UUID_TREE_OBJECTID)
|
||||
return fs_info->uuid_root ? fs_info->uuid_root :
|
||||
ERR_PTR(-ENOENT);
|
||||
if (location->objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
|
||||
return fs_info->free_space_root ? fs_info->free_space_root :
|
||||
ERR_PTR(-ENOENT);
|
||||
again:
|
||||
root = btrfs_lookup_fs_root(fs_info, location->objectid);
|
||||
if (root) {
|
||||
|
@ -2148,6 +2152,7 @@ static void free_root_pointers(struct btrfs_fs_info *info, int chunk_root)
|
|||
free_root_extent_buffers(info->uuid_root);
|
||||
if (chunk_root)
|
||||
free_root_extent_buffers(info->chunk_root);
|
||||
free_root_extent_buffers(info->free_space_root);
|
||||
}
|
||||
|
||||
void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info)
|
||||
|
@ -2448,6 +2453,15 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info,
|
|||
fs_info->uuid_root = root;
|
||||
}
|
||||
|
||||
if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
|
||||
location.objectid = BTRFS_FREE_SPACE_TREE_OBJECTID;
|
||||
root = btrfs_read_tree_root(tree_root, &location);
|
||||
if (IS_ERR(root))
|
||||
return PTR_ERR(root);
|
||||
set_bit(BTRFS_ROOT_TRACK_DIRTY, &root->state);
|
||||
fs_info->free_space_root = root;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3076,6 +3090,30 @@ retry_root_backup:
|
|||
|
||||
btrfs_qgroup_rescan_resume(fs_info);
|
||||
|
||||
if (btrfs_test_opt(tree_root, CLEAR_CACHE) &&
|
||||
btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
|
||||
pr_info("BTRFS: clearing free space tree\n");
|
||||
ret = btrfs_clear_free_space_tree(fs_info);
|
||||
if (ret) {
|
||||
pr_warn("BTRFS: failed to clear free space tree %d\n",
|
||||
ret);
|
||||
close_ctree(tree_root);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) &&
|
||||
!btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
|
||||
pr_info("BTRFS: creating free space tree\n");
|
||||
ret = btrfs_create_free_space_tree(fs_info);
|
||||
if (ret) {
|
||||
pr_warn("BTRFS: failed to create free space tree %d\n",
|
||||
ret);
|
||||
close_ctree(tree_root);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs_info->uuid_root) {
|
||||
pr_info("BTRFS: creating UUID tree\n");
|
||||
ret = btrfs_create_uuid_tree(fs_info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue