Skip to contentSkip to conversation

floating point exception in disk/raid.c:206

PATCH Felix Zielcke 1 participant 3 messages Sep 4, 2008 – Sep 6, 2008

lore
Share & tools
lore
#0 lore raw

static grub_err_t
grub_raid_read (grub_disk_t disk, grub_disk_addr_t sector,

                grub_size_t size, char *buf)

    case 0:
    case 1:
    case 10:
      {
        read_sector = grub_divmod64 (sector, array->chunk_size, &b);

Bean, this is a bit wrong because array->chunk_size is 0 in the RAID 1 case and sector is 0 too in the case I got with gdb.

The easiest fix would be probable to just set chunk_size to for example 64.
Attached patch does it, but maybe you have a better/other idea?

Signature · 1 line
Felix Zielcke

2008-09-04 Felix Zielcke <[email protected]>

* disk/mdraid_linux.c (grub_mdraid_detect): Set `array->chunk_size' to 64 for RAID level 1.
* disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Likewise.

mdraid_linux.c +1 -1
Index: disk/mdraid_linux.c
===================================================================
@@ -200,7 +200,7 @@ grub_mdraid_detect (grub_disk_t disk, st
   array->layout = sb.layout;
   array->total_devs = sb.raid_disks;
   array->disk_size = (sb.size) ? sb.size * 2 : sector;
-  array->chunk_size = sb.chunk_size >> 9;
+  array->chunk_size = (sb.level == 1) ? 64 : sb.chunk_size >> 9;
   array->index = sb.this_disk.number;
   array->uuid_len = 16;
   array->uuid = grub_malloc (16);
dmraid_nvidia.c +1 -1
Index: disk/dmraid_nvidia.c
===================================================================
@@ -135,7 +135,7 @@ grub_dmraid_nv_detect (grub_disk_t disk,
 
   array->number = 0;
   array->total_devs = sb.array.total_volumes;
-  array->chunk_size = sb.array.stripe_block_size;
+  array->chunk_size = (array->level == 1) ? 64 : sb.array.stripe_block_size;
   array->index = sb.unit_number;
   array->uuid_len = sizeof (sb.array.signature);
   array->uuid = grub_malloc (sizeof (sb.array.signature));
#1 lore raw

Am Donnerstag, den 04.09.2008, 11:29 +0200 schrieb Felix Zielcke:

Quoted 3 lines

The easiest fix would be probable to just set chunk_size to for example 64.
Attached patch does it, but maybe you have a better/other idea?

Thanks to Bean on IRC.
I think this is now the right place to do it, at end of insert_array in case of a new one.

Signature · 1 line
Felix Zielcke

2008-09-04 Felix Zielcke <[email protected]>

* disk/raid.c (insert_array): Set `array->chunk_size' to 64 for RAID level 1.

raid.c +5 -0
Index: disk/raid.c
===================================================================
@@ -575,6 +575,11 @@ insert_array (grub_disk_t disk, struct g
       /* Add our new array to the list.  */
       array->next = array_list;
       array_list = array;
+
+      /* RAID 1 doestn't use a chunksize but code assumes one so set
+	 one. */
+      if (array->level == 1)
+	array->chunk_size = 64;
     }
 
   /* Add the device to the array. */
#2 lore raw

Commited.

Am Donnerstag, den 04.09.2008, 21:22 +0200 schrieb Felix Zielcke:

Quoted 9 lines

Am Donnerstag, den 04.09.2008, 11:29 +0200 schrieb Felix Zielcke:

Quoted 3 lines

The easiest fix would be probable to just set chunk_size to for example 64.
Attached patch does it, but maybe you have a better/other idea?

Thanks to Bean on IRC.
I think this is now the right place to do it, at end of insert_array in case of a new one.