]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* disk/raid.c (insert_array): Select unique numbers for named arrays
authorColin Watson <cjwatson@ubuntu.com>
Mon, 2 Aug 2010 14:51:23 +0000 (09:51 -0500)
committerColin Watson <cjwatson@ubuntu.com>
Mon, 2 Aug 2010 14:51:23 +0000 (09:51 -0500)
as well, for use as keys in the disk cache.

ChangeLog
disk/raid.c

index 65d6cb667def233212d3a8e8543b66db2221dcf0..83afffca38bcc239a7cb1a6358cf9836cd4180eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-02  Colin Watson  <cjwatson@ubuntu.com>
+
+       * disk/raid.c (insert_array): Select unique numbers for named arrays
+       as well, for use as keys in the disk cache.
+
 2010-08-01  Robert Millan  <rmh@gnu.org>
 
        * util/grub.d/10_kfreebsd.in: Initialize ${kfreebsd_device} as the
index 7dfd4bd819e4a018d9ca93c2019883deef2d35c7..51a4b00e218b8df8dfb84b759e22b39499f139fc 100644 (file)
@@ -528,25 +528,28 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
       grub_memset (&array->device, 0, sizeof (array->device));
       grub_memset (&array->start_sector, 0, sizeof (array->start_sector));
 
-      if (array->name)
-       goto skip_duplicate_check;
-      /* Check whether we don't have multiple arrays with the same number.  */
-      for (p = array_list; p != NULL; p = p->next)
-        {
-          if (! p->name && p->number == array->number) 
-           break;
-        }
+      if (array->name)
+       {
+         for (p = array_list; p != NULL; p = p->next)
+           {
+             if (! p->name && p->number == array->number) 
+               break;
+           }
+       }
 
-      if (p)
+      if (array->name || p)
         {
-          /* The number is already in use, so we need to find a new one.  */
-          int i = 0;
+         /* The number is already in use, so we need to find a new one.
+            (Or, in the case of named arrays, the array doesn't have its
+            own number, but we need one that doesn't clash for use as a key
+            in the disk cache.  */
+          int i = array->name ? 0x40000000 : 0;
 
          while (1)
            {
              for (p = array_list; p != NULL; p = p->next)
                {
-                 if (! p->name && p->number == i)
+                 if (p->number == i)
                    break;
                }
 
@@ -560,7 +563,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
              i++;
            }
        }
-    skip_duplicate_check:
+
       /* mdraid 1.x superblocks have only a name stored not a number.
         Use it directly as GRUB device.  */
       if (! array->name)