From 3b97788878888b16960c3723d86875a01abc3f2f Mon Sep 17 00:00:00 2001 From: Peter Henn Date: Tue, 1 Jun 2010 18:40:03 +0100 Subject: [PATCH] * disk/mdraid_linux.c (grub_mdraid_detect): Fix calculation of 1.x chunk size and disk size, which are already given as sector counts as distinct from the 0.90 units. Fetch the correct device number from the role table instead of using the table index. --- ChangeLog.raid | 7 +++++++ disk/mdraid_linux.c | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog.raid b/ChangeLog.raid index 854702f41..989f0bc09 100644 --- a/ChangeLog.raid +++ b/ChangeLog.raid @@ -1,3 +1,10 @@ +2009-12-15 Peter Henn + + * disk/mdraid_linux.c (grub_mdraid_detect): Fix calculation of 1.x + chunk size and disk size, which are already given as sector counts + as distinct from the 0.90 units. Fetch the correct device number + from the role table instead of using the table index. + 2009-11-16 Felix Zielcke * disk/mdraid_linux.c (grub_mdraid_detect): Remove a wrong call diff --git a/disk/mdraid_linux.c b/disk/mdraid_linux.c index d29803719..08e10ab45 100644 --- a/disk/mdraid_linux.c +++ b/disk/mdraid_linux.c @@ -371,9 +371,12 @@ superblock_0_90: array->level = grub_le_to_cpu32 (sb_1x->level); array->layout = grub_le_to_cpu32 (sb_1x->layout); array->total_devs = grub_le_to_cpu32 (sb_1x->raid_disks); - array->disk_size = grub_le_to_cpu64 (sb_1x->size) * 2; + array->disk_size = grub_le_to_cpu64 (sb_1x->size); array->chunk_size = grub_le_to_cpu32 (sb_1x->chunksize); - array->index = grub_le_to_cpu32 (sb_1x->dev_number); + if (grub_le_to_cpu32 (sb_1x->dev_number) < grub_le_to_cpu32 (sb_1x->max_dev)) + array->index = grub_le_to_cpu16 (sb_1x->dev_roles[grub_le_to_cpu32 (sb_1x->dev_number)]); + else + array->index = 0xffff; /* disk will be later not used! */ array->uuid_len = 16; array->uuid = grub_malloc (16); if (!array->uuid)