summaryrefslogtreecommitdiffstats
path: root/lib/metadata/raid_manip.c
diff options
context:
space:
mode:
authorJonathan Earl Brassow <jbrassow@redhat.com>2012-02-23 17:36:35 +0000
committerJonathan Earl Brassow <jbrassow@redhat.com>2012-02-23 17:36:35 +0000
commit870762d8e3a585ffe501b74e22abab66965fca55 (patch)
tree7d3e6e9ef0f559171d8c665cff8eded38a350a3a /lib/metadata/raid_manip.c
parentd4836062ff55800080de0279bac491291ab75621 (diff)
downloadlvm2-870762d8e3a585ffe501b74e22abab66965fca55.tar.gz
lvm2-870762d8e3a585ffe501b74e22abab66965fca55.tar.xz
lvm2-870762d8e3a585ffe501b74e22abab66965fca55.zip
Require number of stripes to be greater than parity devices in higher RAID.
Also, add some comments to code that I recently added that may be unclear otherwise.
Diffstat (limited to 'lib/metadata/raid_manip.c')
-rw-r--r--lib/metadata/raid_manip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index e60af176..a4a6a40d 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -519,9 +519,18 @@ static int _alloc_image_components(struct logical_volume *lv,
else if (!(segtype = get_segtype_from_string(lv->vg->cmd, "raid1")))
return_0;
+ /*
+ * The number of extents is based on the RAID type. For RAID1,
+ * each of the rimages is the same size - 'le_count'. However
+ * for RAID 4/5/6, the stripes add together (NOT including the parity
+ * devices) to equal 'le_count'. Thus, when we are allocating
+ * individual devies, we must specify how large the individual device
+ * is along with the number we want ('count').
+ */
extents = (segtype->parity_devs) ?
(lv->le_count / (seg->area_count - segtype->parity_devs)) :
lv->le_count;
+
if (!(ah = allocate_extents(lv->vg, NULL, segtype, 0, count, count,
region_size, extents, pvs,
lv->alloc, parallel_areas)))