diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-07-07 16:15:28 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-07-14 17:39:49 +0200 |
commit | ac677c4d188150f0f09142ca1597006fda63bbe8 (patch) | |
tree | 7a2fa2a7107125c274ac90a0f949c4ae72b54927 /cmds-filesystem.c | |
parent | 032f79d25b1bc91a250d9bdac7c119974337fcdd (diff) |
btrfs-progs: mkfs: Cleanup temporary chunk to avoid strange balance behavior.
[BUG]
# mkfs.btrfs /dev/sdb /dev/sdd -m raid0 -d raid0
# mount /dev/sdb /mnt/btrfs
# btrfs balance start /mnt/btrfs
# btrfs fi df /mnt/btrfs
Data, single: total=1.00GiB, used=320.00KiB
System, single: total=32.00MiB, used=16.00KiB
Metadata, RAID0: total=256.00MiB, used=112.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B
Only metadata stay RAID0. Data and system goes from RAID0 to single.
[REASON]
The problem is caused by the temporary single chunk.
In mkfs, it will always create single data/metadata/sys chunk and them
add device into the temporary btrfs.
When doing all chunk balance, for data and syschunk, they are almost
empty, so balance will move them into the single chunk and remove the
old RAID0 chunk.
For metadata, it has more data and will kick the metadata chunk pre
alloc, so new RAID0 chunk is allocated and the old metadata is move
there. Old RAID0 and single chunks are removed.
[FIX]
Now we add a new function to cleanup the temporary chunks at the end of
mkfs routine.
It will cleanup the chunks which is empty and its profile differs from
the mkfs profile.
So in balance, btrfs will always alloc a new chunk to keep the profile,
other than moving data into the single chunk.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-filesystem.c')
0 files changed, 0 insertions, 0 deletions