btrfs-progs: mkfs: create only desired block groups for single device
authorDavid Sterba <dsterba@suse.com>
Thu, 2 Jul 2015 22:15:18 +0000 (00:15 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 2 Jul 2015 22:15:18 +0000 (00:15 +0200)
commit5f8232e5c8f0b0de0ef426274911385b0e877392
tree59c8f31fbfe29a32a3f02e80793d847c25ee1561
parent9ec25f25fce93ccfdfaad5495e72194e1376b70f
btrfs-progs: mkfs: create only desired block groups for single device

The filesystem creation has to solve some chicken-egg problems and
creates some temporary objects. In our case it's an extra single/single
pair of block groups that's not used unless the user asks that
explicitly.

Example:

Data, single: total=8.00MiB, used=64.00KiB
System, DUP: total=8.00MiB, used=16.00KiB
System, single: total=4.00MiB, used=0.00B
Metadata, DUP: total=153.56MiB, used=112.00KiB
Metadata, single: total=8.00MiB, used=0.00B
GlobalReserve, single: total=16.00MiB, used=0.00B

Even with a single device filesystem and defaults, there's single
block group for metadata and system. The single device case is easy to
fix, we'll simply create the right type from the beginning.

Example:

Data, single: total=8.00MiB, used=64.00KiB
System, DUP: total=4.00MiB, used=16.00KiB
Metadata, DUP: total=136.00MiB, used=112.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B

Filesystem on top of multiple devices still leaves the single/single
groups behind.

Signed-off-by: David Sterba <dsterba@suse.com>
mkfs.c