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.
The check is added to the following btrfs commands:
- btrfs balance pause
- btrfs balance cancel
- btrfs device add
- btrfs device del
The warning is shorter than the before one. Below an example and
it is printed after the normal output of the command.
WARNING: Multiple profiles detected. See 'man btrfs(5)'.
WARNING: data -> [raid1c3, single], metadata -> [raid1, single]
The command "btrfs fi us" doesn't show the warning above, instead
it was added a further line in the "Overall" section. The output now
is this:
$ sudo ./btrfs fi us /tmp/t/
[sudo] password for ghigo:
Overall:
Device size: 30.00GiB
Device allocated: 4.78GiB
Device unallocated: 25.22GiB
Device missing: 0.00B
Used: 1.95GiB
Free (estimated): 13.87GiB (min: 9.67GiB)
Data ratio: 2.00
Metadata ratio: 1.50
Global reserve: 3.25MiB (used: 0.00B)
Multiple profile: YES
Data,single: Size:1.00GiB, Used:974.04MiB (95.12%)
/dev/loop0 1.00GiB
Data,RAID1C3: Size:1.00GiB, Used:178.59MiB (17.44%)
/dev/loop0 1.00GiB
/dev/loop1 1.00GiB
/dev/loop2 1.00GiB
Metadata,single: Size:256.00MiB, Used:76.22MiB (29.77%)
/dev/loop1 256.00MiB
Metadata,RAID1: Size:256.00MiB, Used:206.92MiB (80.83%)
/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 8.00GiB
/dev/loop1 8.50GiB
/dev/loop2 8.72GiB
In this case there are two kind of chunks for data (raid1c3 and single)
and metadata (raid1, single).
As the previous patch set, the warning is added also to the command
'btrfs fi df' and 'btrfs dev us' as separate patch. If even in this
review nobody likes it, we can simply drop this patch.
Suggestion about which commands should (not) have this check are
welcome.
v1
- first issue
v2
- add some needed missing pieces about raid1c[34]
- add the check to more btrfs commands
v3
- add a section in btrfs(5) 'FILESYSTEM WITH MULTIPLE PROFILES'
- 'btrfs fi us': changed the worning in a info in the 'overall' section
Patch #1 contains the code for the check.
Patch #3 adds the check to the command 'btrfs dev {add,del}' and 'btrfs
bal {pause, stop}'
Patch #3 adds the check to the command 'btrfs fi us'
Patch #5 add the check to the command 'btrfs fi df' and 'btrfs dev us'
Patch #5 add the info in btrfs(5) man page
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