Skip to content

Commit 9d09e66

Browse files
neilbrownkergon
authored andcommitted
dm: raid456 basic support
This patch is the skeleton for the DM target that will be the bridge from DM to MD (initially RAID456 and later RAID1). It provides a way to use device-mapper interfaces to the MD RAID456 drivers. As with all device-mapper targets, the nominal public interfaces are the constructor (CTR) tables and the status outputs (both STATUSTYPE_INFO and STATUSTYPE_TABLE). The CTR table looks like the following: 1: <s> <l> raid \ 2: <raid_type> <#raid_params> <raid_params> \ 3: <#raid_devs> <meta_dev1> <dev1> .. <meta_devN> <devN> Line 1 contains the standard first three arguments to any device-mapper target - the start, length, and target type fields. The target type in this case is "raid". Line 2 contains the arguments that define the particular raid type/personality/level, the required arguments for that raid type, and any optional arguments. Possible raid types include: raid4, raid5_la, raid5_ls, raid5_rs, raid6_zr, raid6_nr, and raid6_nc. (again, raid1 is planned for the future.) The list of required and optional parameters is the same for all the current raid types. The required parameters are positional, while the optional parameters are given as key/value pairs. The possible parameters are as follows: <chunk_size> Chunk size in sectors. [[no]sync] Force/Prevent RAID initialization [rebuild <idx>] Rebuild the drive indicated by the index [daemon_sleep <ms>] Time between bitmap daemon work to clear bits [min_recovery_rate <kB/sec/disk>] Throttle RAID initialization [max_recovery_rate <kB/sec/disk>] Throttle RAID initialization [max_write_behind <value>] See '-write-behind=' (man mdadm) [stripe_cache <sectors>] Stripe cache size for higher RAIDs Line 3 contains the list of devices that compose the array in metadata/data device pairs. If the metadata is stored separately, a '-' is given for the metadata device position. 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. Examples: # RAID4 - 4 data drives, 1 parity # No metadata devices specified to hold superblock/bitmap info # Chunk size of 1MiB # (Lines separated for easy reading) 0 1960893648 raid \ raid4 1 2048 \ 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81 # RAID4 - 4 data drives, 1 parity (no metadata devices) # Chunk size of 1MiB, force RAID initialization, # min recovery rate at 20 kiB/sec/disk 0 1960893648 raid \ raid4 4 2048 min_recovery_rate 20 sync\ 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81 Performing a 'dmsetup table' should display the CTR table used to construct the mapping (with possible reordering of optional parameters). Performing a 'dmsetup status' will yield information on the state and health of the array. The output is as follows: 1: <s> <l> raid \ 2: <raid_type> <#devices> <1 health char for each dev> <resync_ratio> Line 1 is standard DM output. Line 2 is best shown by example: 0 1960893648 raid raid4 5 AAAAA 2/490221568 Here we can see the RAID type is raid4, there are 5 devices - all of which are 'A'live, and the array is 2/490221568 complete with recovery. Cc: linux-raid@vger.kernel.org Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
1 parent 99d03c1 commit 9d09e66

4 files changed

Lines changed: 792 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Device-mapper RAID (dm-raid) is a bridge from DM to MD. It
2+
provides a way to use device-mapper interfaces to access the MD RAID
3+
drivers.
4+
5+
As with all device-mapper targets, the nominal public interfaces are the
6+
constructor (CTR) tables and the status outputs (both STATUSTYPE_INFO
7+
and STATUSTYPE_TABLE). The CTR table looks like the following:
8+
9+
1: <s> <l> raid \
10+
2: <raid_type> <#raid_params> <raid_params> \
11+
3: <#raid_devs> <meta_dev1> <dev1> .. <meta_devN> <devN>
12+
13+
Line 1 contains the standard first three arguments to any device-mapper
14+
target - the start, length, and target type fields. The target type in
15+
this case is "raid".
16+
17+
Line 2 contains the arguments that define the particular raid
18+
type/personality/level, the required arguments for that raid type, and
19+
any optional arguments. Possible raid types include: raid4, raid5_la,
20+
raid5_ls, raid5_rs, raid6_zr, raid6_nr, and raid6_nc. (raid1 is
21+
planned for the future.) The list of required and optional parameters
22+
is the same for all the current raid types. The required parameters are
23+
positional, while the optional parameters are given as key/value pairs.
24+
The possible parameters are as follows:
25+
<chunk_size> Chunk size in sectors.
26+
[[no]sync] Force/Prevent RAID initialization
27+
[rebuild <idx>] Rebuild the drive indicated by the index
28+
[daemon_sleep <ms>] Time between bitmap daemon work to clear bits
29+
[min_recovery_rate <kB/sec/disk>] Throttle RAID initialization
30+
[max_recovery_rate <kB/sec/disk>] Throttle RAID initialization
31+
[max_write_behind <sectors>] See '-write-behind=' (man mdadm)
32+
[stripe_cache <sectors>] Stripe cache size for higher RAIDs
33+
34+
Line 3 contains the list of devices that compose the array in
35+
metadata/data device pairs. If the metadata is stored separately, a '-'
36+
is given for the metadata device position. If a drive has failed or is
37+
missing at creation time, a '-' can be given for both the metadata and
38+
data drives for a given position.
39+
40+
NB. Currently all metadata devices must be specified as '-'.
41+
42+
Examples:
43+
# RAID4 - 4 data drives, 1 parity
44+
# No metadata devices specified to hold superblock/bitmap info
45+
# Chunk size of 1MiB
46+
# (Lines separated for easy reading)
47+
0 1960893648 raid \
48+
raid4 1 2048 \
49+
5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
50+
51+
# RAID4 - 4 data drives, 1 parity (no metadata devices)
52+
# Chunk size of 1MiB, force RAID initialization,
53+
# min recovery rate at 20 kiB/sec/disk
54+
0 1960893648 raid \
55+
raid4 4 2048 min_recovery_rate 20 sync\
56+
5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
57+
58+
Performing a 'dmsetup table' should display the CTR table used to
59+
construct the mapping (with possible reordering of optional
60+
parameters).
61+
62+
Performing a 'dmsetup status' will yield information on the state and
63+
health of the array. The output is as follows:
64+
1: <s> <l> raid \
65+
2: <raid_type> <#devices> <1 health char for each dev> <resync_ratio>
66+
67+
Line 1 is standard DM output. Line 2 is best shown by example:
68+
0 1960893648 raid raid4 5 AAAAA 2/490221568
69+
Here we can see the RAID type is raid4, there are 5 devices - all of
70+
which are 'A'live, and the array is 2/490221568 complete with recovery.

‎drivers/md/Kconfig‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,30 @@ config DM_MIRROR
240240
Allow volume managers to mirror logical volumes, also
241241
needed for live data migration tools such as 'pvmove'.
242242

243+
config DM_RAID
244+
tristate "RAID 4/5/6 target (EXPERIMENTAL)"
245+
depends on BLK_DEV_DM && EXPERIMENTAL
246+
select MD_RAID456
247+
select BLK_DEV_MD
248+
---help---
249+
A dm target that supports RAID4, RAID5 and RAID6 mappings
250+
251+
A RAID-5 set of N drives with a capacity of C MB per drive provides
252+
the capacity of C * (N - 1) MB, and protects against a failure
253+
of a single drive. For a given sector (row) number, (N - 1) drives
254+
contain data sectors, and one drive contains the parity protection.
255+
For a RAID-4 set, the parity blocks are present on a single drive,
256+
while a RAID-5 set distributes the parity across the drives in one
257+
of the available parity distribution methods.
258+
259+
A RAID-6 set of N drives with a capacity of C MB per drive
260+
provides the capacity of C * (N - 2) MB, and protects
261+
against a failure of any two drives. For a given sector
262+
(row) number, (N - 2) drives contain data sectors, and two
263+
drives contains two independent redundancy syndromes. Like
264+
RAID-5, RAID-6 distributes the syndromes across the drives
265+
in one of the available parity distribution methods.
266+
243267
config DM_LOG_USERSPACE
244268
tristate "Mirror userspace logging (EXPERIMENTAL)"
245269
depends on DM_MIRROR && EXPERIMENTAL && NET

‎drivers/md/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o
3636
obj-$(CONFIG_DM_MIRROR) += dm-mirror.o dm-log.o dm-region-hash.o
3737
obj-$(CONFIG_DM_LOG_USERSPACE) += dm-log-userspace.o
3838
obj-$(CONFIG_DM_ZERO) += dm-zero.o
39+
obj-$(CONFIG_DM_RAID) += dm-raid.o
3940

4041
ifeq ($(CONFIG_DM_UEVENT),y)
4142
dm-mod-objs += dm-uevent.o

0 commit comments

Comments
 (0)