summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-04-12 00:58:27 -0700
committerDan Williams <dan.j.williams@intel.com>2009-04-12 00:58:27 -0700
commitff5963088d487e6b7f16fb7cb260bf9cac60bf4a (patch)
tree947d7aa2728a5df66515c35050cde722efc2f59c
parent1f45a8ad2083d6b9de6e37ae46e8ac957694d0f8 (diff)
downloadmdadm-ff5963088d487e6b7f16fb7cb260bf9cac60bf4a.tar.gz
mdadm-ff5963088d487e6b7f16fb7cb260bf9cac60bf4a.tar.xz
mdadm-ff5963088d487e6b7f16fb7cb260bf9cac60bf4a.zip
imsm: fix imsm_map.num_domains
'num_domains' is the number of parity domains. I.e. 2 in the raid10 case (2-mirrors), while raid0 through raid5 have 1 parity domain (even though raid0 does not have parity). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--super-intel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/super-intel.c b/super-intel.c
index 4754b25..9b8cea2 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2191,13 +2191,12 @@ static __u16 info_to_blocks_per_strip(mdu_array_info_t *info)
return info->chunk_size >> 9;
}
-static __u32 info_to_num_data_stripes(mdu_array_info_t *info)
+static __u32 info_to_num_data_stripes(mdu_array_info_t *info, int num_domains)
{
__u32 num_stripes;
num_stripes = (info->size * 2) / info_to_blocks_per_strip(info);
- if (info->level == 1)
- num_stripes /= 2;
+ num_stripes /= num_domains;
return num_stripes;
}
@@ -2274,6 +2273,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
int i;
unsigned long long array_blocks;
size_t size_old, size_new;
+ __u32 num_data_stripes;
if (super->orom && mpb->num_raid_devs >= super->orom->vpa) {
fprintf(stderr, Name": This imsm-container already has the "
@@ -2349,7 +2349,6 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
map->pba_of_lba0 = __cpu_to_le32(super->create_offset);
map->blocks_per_member = __cpu_to_le32(info_to_blocks_per_member(info));
map->blocks_per_strip = __cpu_to_le16(info_to_blocks_per_strip(info));
- map->num_data_stripes = __cpu_to_le32(info_to_num_data_stripes(info));
map->failed_disk_num = ~0;
map->map_state = info->level ? IMSM_T_STATE_UNINITIALIZED :
IMSM_T_STATE_NORMAL;
@@ -2364,8 +2363,10 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
map->num_domains = info->raid_disks / 2;
} else {
map->raid_level = info->level;
- map->num_domains = !!map->raid_level;
+ map->num_domains = 1;
}
+ num_data_stripes = info_to_num_data_stripes(info, map->num_domains);
+ map->num_data_stripes = __cpu_to_le32(num_data_stripes);
map->num_members = info->raid_disks;
for (i = 0; i < map->num_members; i++) {