Revert "btrfs-progs: mkfs: create only desired block groups for single device"
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 14 Jul 2015 02:13:01 +0000 (10:13 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Jul 2015 11:42:13 +0000 (13:42 +0200)
commit922352bcfbd41912559919fc6bef1f89406881c7
treee94836d386c4d49b812d5c24fd874da98115efa1
parent20be329fdb569fefdf88ba0e4ca1a41488fcbc19
Revert "btrfs-progs: mkfs: create only desired block groups for single device"

This reverts commit 5f8232e5c8f0b0de0ef426274911385b0e877392.

This commit causes a regression:

$ mkfs.btrfs -f /dev/sda6
$ btrfsck /dev/sda6
Checking filesystem on /dev/sda6
UUID: 2ebb483c-1986-4610-802a-c6f3e6ab4b76
checking extents
Chunk[256, 228, 0]: length(4194304), offset(0), type(2) mismatch with
block group[0, 192, 4194304]: offset(4194304), objectid(0), flags(34)
Chunk[256, 228, 4194304]: length(8388608), offset(4194304), type(4)
mismatch with block group[4194304, 192, 8388608]: offset(8388608),
objectid(4194304), flags(36)
Block group[0, 4194304] (flags = 34) didn't find the relative chunk.
Block group[4194304, 8388608] (flags = 36) didn't find the relative
chunk.
......

The commit has the following bug causing the problem.
1) Typo forgets to add meta/data_profile for alloc_chunk.
Only meta/data_profile is added to allocate a block group, but not
chunk.

2) Type for the first system chunk is impossible to modify yet.
The type for the first chunk and its stripe is hard coded into
make_btrfs() function.
So even we try to modify the type of the block group, we are unable to
change the type of the first chunk.
Causing the chunk type mismatch problem.

The 1st bug can be fixed quite easily but the second is not.
The good news is, the last patch "btrfs-progs: mkfs: Cleanup temporary
chunk to avoid strange balance behavior." from my patchset can handle it
quite well alone.

So just revert the patch.
New bug fix for btrfsck(err is 0 even chunk/extent tree is corrupted) and
new test cases for mkfs will follow soon.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
mkfs.c