Hi all,
the aim of this patch set is to issue a warning when a mixed profiles
filesystem is detected. This happens when the filesystems contains
(i.e.) raid1c3 and single chunk for data.
BTRFS has the capability to support a filesystem with mixed profiles.
However this could lead to an unexpected behavior when a new chunk is
allocated (i.e. the chunk profile is not what is wanted). Moreover
if the user is not aware of this, he could assume a redundancy which
doesn't exist (for example because there is some 'single' chunk when
it is expected the filesystem to be full raid1).
A possible cause of a mixed profiles filesystem is an interrupted
balance operation or a not fully balance due to very specific filter.
In this first attempt the check is only added to the 'btrfs fi us'
command. I hope to receive suggestion about which commands should
have this check (I think all the commands which interact with a
mounted filesystem).
Example of output:
$ sudo ./btrfs fi us /tmp/t/
WARNING: ------------------------------------------------------
WARNING: Detection of multiple profiles for a block group type:
WARNING:
WARNING: * DATA -> [raid1c3, single]
WARNING: * METADATA -> [raid1, single]
WARNING:
WARNING: Please consider using 'btrfs balance ...' commands set
WARNING: to solve this issue.
WARNING: ------------------------------------------------------
Overall:
Device size: 30.00GiB
Device allocated: 7.78GiB
Device unallocated: 22.22GiB
Device missing: 0.00B
Used: 1.84GiB
Free (estimated): 11.93GiB (min: 9.82GiB)
Data ratio: 2.33
Metadata ratio: 1.50
Global reserve: 3.25MiB (used: 0.00B)
Data,single: Size:1.00GiB, Used:1023.91MiB (99.99%)
/dev/loop0 1.00GiB
Data,RAID1C3: Size:2.00GiB, Used:128.90MiB (6.29%)
/dev/loop0 2.00GiB
/dev/loop1 2.00GiB
/dev/loop2 2.00GiB
Metadata,single: Size:256.00MiB, Used:88.67MiB (34.64%)
/dev/loop1 256.00MiB
Metadata,RAID1: Size:256.00MiB, Used:194.28MiB (75.89%)
/dev/loop1 256.00MiB
/dev/loop2 256.00MiB
System,single: Size:32.00MiB, Used:16.00KiB (0.05%)
/dev/loop2 32.00MiB
Unallocated:
/dev/loop0 7.00GiB
/dev/loop1 7.50GiB
/dev/loop2 7.72GiB
In this case there are two kind of chunks for data (raid1c3 and single)
and metadata (raid1, single).
Patch #1 and #2 are preparatory ones.
Patch #3 contains the code for the check.
Patch #4 adds the check to the command 'btrfs fi us'
Comments are welcome
BR
G.Baroncelli
--
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5