summaryrefslogtreecommitdiff
path: root/mkfs/main.c
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2017-10-19 15:36:57 +0800
committerDavid Sterba <dsterba@suse.com>2018-01-08 18:14:33 +0100
commitc7bc72264aed05e00edcb4f0575abf841d621dc8 (patch)
tree9e36e9d87178a3a345b4b15dfa0ba59a9ffebed2 /mkfs/main.c
parent2fd0f3a98040a9744869d7c50f744250b1cac6fe (diff)
btrfs-progs: mkfs: Don't use custom chunk allocator for rootdir
Remove the custom chunk allocator for mkfs. It is buggy in connection to the --rootdir option and puts file data to the reerved 1M area. The feature of the custom allocator was to reserve only minimal amount of blockgroup space. This will temporarily stop working and will need an explicit request by option, added by following patches. Use the generic chunk allocator. Signed-off-by: Qu Wenruo <wqu@suse.com> [ update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs/main.c')
-rw-r--r--mkfs/main.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/mkfs/main.c b/mkfs/main.c
index ec6b2f85..86c60d0e 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -400,53 +400,6 @@ static char *parse_label(const char *input)
return strdup(input);
}
-static int create_chunks(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 num_of_meta_chunks,
- u64 size_of_data,
- struct mkfs_allocation *allocation)
-{
- struct btrfs_fs_info *fs_info = root->fs_info;
- u64 chunk_start;
- u64 chunk_size;
- u64 meta_type = BTRFS_BLOCK_GROUP_METADATA;
- u64 data_type = BTRFS_BLOCK_GROUP_DATA;
- u64 minimum_data_chunk_size = SZ_8M;
- u64 i;
- int ret;
-
- for (i = 0; i < num_of_meta_chunks; i++) {
- ret = btrfs_alloc_chunk(trans, fs_info,
- &chunk_start, &chunk_size, meta_type);
- if (ret)
- return ret;
- ret = btrfs_make_block_group(trans, fs_info, 0,
- meta_type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
- chunk_start, chunk_size);
- allocation->metadata += chunk_size;
- if (ret)
- return ret;
- set_extent_dirty(&root->fs_info->free_space_cache,
- chunk_start, chunk_start + chunk_size - 1);
- }
-
- if (size_of_data < minimum_data_chunk_size)
- size_of_data = minimum_data_chunk_size;
-
- ret = btrfs_alloc_data_chunk(trans, fs_info,
- &chunk_start, size_of_data, data_type, 0);
- if (ret)
- return ret;
- ret = btrfs_make_block_group(trans, fs_info, 0,
- data_type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
- chunk_start, size_of_data);
- allocation->data += size_of_data;
- if (ret)
- return ret;
- set_extent_dirty(&root->fs_info->free_space_cache,
- chunk_start, chunk_start + size_of_data - 1);
- return ret;
-}
-
static int zero_output_file(int out_fd, u64 size)
{
int loop_num;
@@ -1231,21 +1184,6 @@ raid_groups:
}
if (source_dir_set) {
- trans = btrfs_start_transaction(root, 1);
- BUG_ON(IS_ERR(trans));
- ret = create_chunks(trans, root,
- num_of_meta_chunks, size_of_data,
- &allocation);
- if (ret) {
- error("unable to create chunks: %d", ret);
- goto out;
- }
- ret = btrfs_commit_transaction(trans, root);
- if (ret) {
- error("transaction commit failed: %d", ret);
- goto out;
- }
-
ret = btrfs_mkfs_fill_dir(source_dir, root, verbose);
if (ret) {
error("error wihle filling filesystem: %d", ret);