summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-12-23 00:17:56 +0100
committerNeilBrown <neilb@suse.de>2011-12-23 00:17:56 +0100
commit8f19ccb2fd70deb1f278be5e75076074cfddee46 (patch)
tree59419e814d4d02dfdefaf6f5ef152c3468c890e8 /drivers/md/raid1.h
parentmd/raid1: Replace use of mddev->raid_disks with conf->raid_disks. (diff)
downloadlinux-8f19ccb2fd70deb1f278be5e75076074cfddee46.tar.xz
linux-8f19ccb2fd70deb1f278be5e75076074cfddee46.zip
md/raid1: Allocate spare to store replacement devices and their bios.
In RAID1, a replacement is much like a normal device, so we just double the size of the relevant arrays and look at all possible devices for reads and writes. This means that the array looks like it is now double the size in some way - we need to be careful about that. In particular, we checking if the array is still degraded while creating a recovery request we need to only consider the first 'half' - i.e. the real (non-replacement) devices. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.h')
-rw-r--r--drivers/md/raid1.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h
index c732b6cce935..80ded139314c 100644
--- a/drivers/md/raid1.h
+++ b/drivers/md/raid1.h
@@ -12,6 +12,9 @@ struct mirror_info {
* pool was allocated for, so they know how much to allocate and free.
* mddev->raid_disks cannot be used, as it can change while a pool is active
* These two datums are stored in a kmalloced struct.
+ * The 'raid_disks' here is twice the raid_disks in r1conf.
+ * This allows space for each 'real' device can have a replacement in the
+ * second half of the array.
*/
struct pool_info {
@@ -21,7 +24,9 @@ struct pool_info {
struct r1conf {
struct mddev *mddev;
- struct mirror_info *mirrors;
+ struct mirror_info *mirrors; /* twice 'raid_disks' to
+ * allow for replacements.
+ */
int raid_disks;
/* When choose the best device for a read (read_balance())