[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Get mdraid 1.x array size from data_size if size is zero
From: |
Colin Watson |
Subject: |
[PATCH] Get mdraid 1.x array size from data_size if size is zero |
Date: |
Mon, 28 Mar 2011 16:22:42 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On RAID-0 devices, the 'size' member in the RAID superblock is 0,
meaning (as far as I can tell) "use all available space in physical
volume". GRUB's mdraid 0.9 support handles this, but its mdraid 1.x
support does not. The 'data_size' member is more useful.
I've continued using 'size' if it's non-zero, partly for minimal risk to
1.99 (so this shouldn't break anything that currently works) and partly
because 'data_size' is a bit larger than 'size' on RAID-1 and I thought
we probably ought to use the smaller size in case the larger size
included some kind of reserved blocks. I didn't have time to unpick the
full details of the differences from mdadm.
This was originally reported as:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/743136
2011-03-28 Colin Watson <address@hidden>
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): If
real_sb->size is zero (e.g. RAID-0), get the disk size from
real_sb->data_size instead.
Fixes Ubuntu bug #743136.
=== modified file 'grub-core/disk/mdraid1x_linux.c'
--- grub-core/disk/mdraid1x_linux.c 2011-03-28 14:17:22 +0000
+++ grub-core/disk/mdraid1x_linux.c 2011-03-28 15:18:10 +0000
@@ -192,7 +192,10 @@ grub_mdraid_detect (grub_disk_t disk, st
array->level = grub_le_to_cpu32 (real_sb->level);
array->layout = grub_le_to_cpu32 (real_sb->layout);
array->total_devs = grub_le_to_cpu32 (real_sb->raid_disks);
- array->disk_size = grub_le_to_cpu64 (real_sb->size);
+ if (real_sb->size)
+ array->disk_size = grub_le_to_cpu64 (real_sb->size);
+ else
+ array->disk_size = grub_le_to_cpu64 (real_sb->data_size);
array->chunk_size = grub_le_to_cpu32 (real_sb->chunksize);
if (grub_le_to_cpu32 (real_sb->dev_number) >=
--
Colin Watson address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Get mdraid 1.x array size from data_size if size is zero,
Colin Watson <=