diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2016-01-29 13:03:31 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-06-07 18:15:19 +0200 |
commit | 561f773433129acf5ba2bdd9abd85876f5d098ce (patch) | |
tree | 1d35f3486949edbf0ab7dcf489104c60878c4253 /extent-tree.c | |
parent | e5724bfc8e015835154b77a6e2b1eb7ed4b9f16c (diff) |
btrfs-progs: convert: Strictly avoid meta or system chunk allocation
Before this patch, btrfs-convert only rely on large enough initial
system/metadata chunk size to ensure no newer system/meta chunk will be
created.
But that's not safe enough. So add two new members in fs_info,
avoid_sys/meta_chunk_alloc flags to prevent any newer system or meta
chunks to be created before init_btrfs_v2().
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r-- | extent-tree.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/extent-tree.c b/extent-tree.c index 45cb439f..f9e4bf2d 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1904,6 +1904,16 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans, thresh) return 0; + /* + * Avoid allocating given chunk type + */ + if (extent_root->fs_info->avoid_meta_chunk_alloc && + (flags & BTRFS_BLOCK_GROUP_METADATA)) + return 0; + if (extent_root->fs_info->avoid_sys_chunk_alloc && + (flags & BTRFS_BLOCK_GROUP_SYSTEM)) + return 0; + ret = btrfs_alloc_chunk(trans, extent_root, &start, &num_bytes, space_info->flags); if (ret == -ENOSPC) { |