]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* disk/mdraid_linux.c (grub_mdraid_detect): Fix calculation of 1.x
authorPeter Henn <peter.henn@web.de>
Tue, 1 Jun 2010 17:40:03 +0000 (18:40 +0100)
committerColin Watson <cjwatson@debian.org>
Tue, 1 Jun 2010 17:40:03 +0000 (18:40 +0100)
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
disk/mdraid_linux.c

index 854702f41ac97261bc6744b1b59f04c2fbd0e480..989f0bc09337b5597d9ea5732888e903c9dc9ce9 100644 (file)
@@ -1,3 +1,10 @@
+2009-12-15  Peter Henn  <peter.henn@web.de>
+
+       * 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  <fzielcke@z-51.de>
 
        * disk/mdraid_linux.c (grub_mdraid_detect): Remove a wrong call
index d29803719fd2129480007996eac44ae01b8d4b74..08e10ab45306385c4699cc1999867a54d0b8e879 100644 (file)
@@ -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)