Commit b12d437b authored by Jonathan Brassow's avatar Jonathan Brassow Committed by Alasdair G Kergon

dm raid: support metadata devices

Add the ability to parse and use metadata devices to dm-raid.  Although
not strictly required, without the metadata devices, many features of
RAID are unavailable.  They are used to store a superblock and bitmap.

The role, or position in the array, of each device must be recorded in
its superblock.  This is to help with fault handling, array reshaping,
and sanity checks.  RAID 4/5/6 devices must be loaded in a specific order:
in this way, the 'array_position' field helps validate the correctness
of the mapping when it is loaded.  It can be used during reshaping to
identify which devices are added/removed.  Fault handling is impossible
without this field.  For example, when a device fails it is recorded in
the superblock.  If this is a RAID1 device and the offending device is
removed from the array, there must be a way during subsequent array
assembly to determine that the failed device was the one removed.  This
is done by correlating the 'array_position' field and the bit-field
variable 'failed_devices'.
Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 46bed2b5
...@@ -11,6 +11,7 @@ The target is named "raid" and it accepts the following parameters: ...@@ -11,6 +11,7 @@ The target is named "raid" and it accepts the following parameters:
<#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>] <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>]
<raid_type>: <raid_type>:
raid1 RAID1 mirroring
raid4 RAID4 dedicated parity disk raid4 RAID4 dedicated parity disk
raid5_la RAID5 left asymmetric raid5_la RAID5 left asymmetric
- rotating parity 0 with data continuation - rotating parity 0 with data continuation
...@@ -61,8 +62,7 @@ The target is named "raid" and it accepts the following parameters: ...@@ -61,8 +62,7 @@ The target is named "raid" and it accepts the following parameters:
<#raid_devs>: The number of devices composing the array. <#raid_devs>: The number of devices composing the array.
Each device consists of two entries. The first is the device Each device consists of two entries. The first is the device
containing the metadata (if any); the second is the one containing the containing the metadata (if any); the second is the one containing the
data. Currently, separate metadata devices are not supported and '-' data.
is required in place of the metadata device.
If a drive has failed or is missing at creation time, a '-' can be If a drive has failed or is missing at creation time, a '-' can be
given for both the metadata and data drives for a given position. given for both the metadata and data drives for a given position.
...@@ -70,7 +70,7 @@ The target is named "raid" and it accepts the following parameters: ...@@ -70,7 +70,7 @@ The target is named "raid" and it accepts the following parameters:
Example tables Example tables
-------------- --------------
# RAID4 - 4 data drives, 1 parity # RAID4 - 4 data drives, 1 parity (no metadata devices)
# No metadata devices specified to hold superblock/bitmap info # No metadata devices specified to hold superblock/bitmap info
# Chunk size of 1MiB # Chunk size of 1MiB
# (Lines separated for easy reading) # (Lines separated for easy reading)
...@@ -79,13 +79,13 @@ Example tables ...@@ -79,13 +79,13 @@ Example tables
raid4 1 2048 \ raid4 1 2048 \
5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
# RAID4 - 4 data drives, 1 parity (no metadata devices) # RAID4 - 4 data drives, 1 parity (with metadata devices)
# Chunk size of 1MiB, force RAID initialization, # Chunk size of 1MiB, force RAID initialization,
# min recovery rate at 20 kiB/sec/disk # min recovery rate at 20 kiB/sec/disk
0 1960893648 raid \ 0 1960893648 raid \
raid4 4 2048 min_recovery_rate 20 sync\ raid4 4 2048 sync min_recovery_rate 20 \
5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82
'dmsetup table' displays the table used to construct the mapping. 'dmsetup table' displays the table used to construct the mapping.
The optional parameters are always printed in the order listed The optional parameters are always printed in the order listed
......
...@@ -241,12 +241,13 @@ config DM_MIRROR ...@@ -241,12 +241,13 @@ config DM_MIRROR
needed for live data migration tools such as 'pvmove'. needed for live data migration tools such as 'pvmove'.
config DM_RAID config DM_RAID
tristate "RAID 4/5/6 target (EXPERIMENTAL)" tristate "RAID 1/4/5/6 target (EXPERIMENTAL)"
depends on BLK_DEV_DM && EXPERIMENTAL depends on BLK_DEV_DM && EXPERIMENTAL
select MD_RAID1
select MD_RAID456 select MD_RAID456
select BLK_DEV_MD select BLK_DEV_MD
---help--- ---help---
A dm target that supports RAID4, RAID5 and RAID6 mappings A dm target that supports RAID1, RAID4, RAID5 and RAID6 mappings
A RAID-5 set of N drives with a capacity of C MB per drive provides A RAID-5 set of N drives with a capacity of C MB per drive provides
the capacity of C * (N - 1) MB, and protects against a failure the capacity of C * (N - 1) MB, and protects against a failure
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment