Skip to contentSkip to conversation

add support for Linux MD linear level

PATCH In review Andrey Borzenkov 2 participants 2 messages Jun 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add support for Linux MD linear level

This appears to be trivial enough and occasionally useful.

It also fixes level translation for 1.x super which was broken for multipath level as well.

---
 ChangeLog                       | 8 ++++++++
 grub-core/disk/mdraid1x_linux.c | 6 +++---
 grub-core/disk/mdraid_linux.c   | 4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)
ChangeLog +8 -0
index 4d8f343..e4c1980 100644
@@ -1,3 +1,11 @@
+2013-06-08  Andrey Borzenkov <[email protected]>
+
+	* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Support
+	linear level by mapping it to RAID1. Pass correct mapped level
+	to grub_diskfilter_make_raid.
+	* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Support
+	linear level by mapping it to RAID1.
+
 2013-06-07  Andrey Borzenkov <[email protected]>
 
 	* grub-core/script/execute.c (grub_script_execute_sourcecode): Split
grub-core/disk/mdraid1x_linux.c +3 -3
index a0e65a8..3c18c79 100644
@@ -160,8 +160,8 @@ grub_mdraid_detect (grub_disk_t disk,
 
       level = grub_le_to_cpu32 (sb.level);
 
-      /* Multipath.  */
-      if ((int) level == -4)
+      /* Multipath or linear  */
+      if ((int) level == -4 || (int) level == -1)
 	level = 1;
 
       if (level != 0 && level != 1 && level != 4 &&
@@ -207,7 +207,7 @@ grub_mdraid_detect (grub_disk_t disk,
 					 : grub_le_to_cpu64 (sb.data_size),
 					 grub_le_to_cpu32 (sb.chunksize),
 					 grub_le_to_cpu32 (sb.layout),
-					 grub_le_to_cpu32 (sb.level));
+					 level);
 
       return array;
     }
grub-core/disk/mdraid_linux.c +2 -2
index f408fd3..4e64d72 100644
@@ -216,8 +216,8 @@ grub_mdraid_detect (grub_disk_t disk,
   /* FIXME: Check the checksum.  */
 
   level = grub_md_to_cpu32 (sb.level);
-  /* Multipath.  */
-  if ((int) level == -4)
+  /* Multipath or linear  */
+  if ((int) level == -4 || (int) level == -1)
     level = 1;
 
   if (level != 0 && level != 1 && level != 4 &&
Signature · 1 line
tg: (ac72fb7..) u/md_linear (depends on: master)
#1 lore raw
Quoted 4 lines · Andrey Borzenkov

This appears to be trivial enough and occasionally useful.

It also fixes level translation for 1.x super which was broken for multipath level as well.

Linear isn't RAID1. You'd need to define a segment for every device.

Quoted 65 lines
---
 ChangeLog                       | 8 ++++++++
 grub-core/disk/mdraid1x_linux.c | 6 +++---
 grub-core/disk/mdraid_linux.c   | 4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)
ChangeLog +8 -0
index 4d8f343..e4c1980 100644
@@ -1,3 +1,11 @@
+2013-06-08  Andrey Borzenkov <[email protected]>
+
+	* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Support
+	linear level by mapping it to RAID1. Pass correct mapped level
+	to grub_diskfilter_make_raid.
+	* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Support
+	linear level by mapping it to RAID1.
+
 2013-06-07  Andrey Borzenkov <[email protected]>
 
 	* grub-core/script/execute.c (grub_script_execute_sourcecode): Split
grub-core/disk/mdraid1x_linux.c +3 -3
index a0e65a8..3c18c79 100644
@@ -160,8 +160,8 @@ grub_mdraid_detect (grub_disk_t disk,
 
       level = grub_le_to_cpu32 (sb.level);
 
-      /* Multipath.  */
-      if ((int) level == -4)
+      /* Multipath or linear  */
+      if ((int) level == -4 || (int) level == -1)
 	level = 1;
 
       if (level != 0 && level != 1 && level != 4 &&
@@ -207,7 +207,7 @@ grub_mdraid_detect (grub_disk_t disk,
 					 : grub_le_to_cpu64 (sb.data_size),
 					 grub_le_to_cpu32 (sb.chunksize),
 					 grub_le_to_cpu32 (sb.layout),
-					 grub_le_to_cpu32 (sb.level));
+					 level);
 
       return array;
     }
grub-core/disk/mdraid_linux.c +2 -2
index f408fd3..4e64d72 100644
@@ -216,8 +216,8 @@ grub_mdraid_detect (grub_disk_t disk,
   /* FIXME: Check the checksum.  */
 
   level = grub_md_to_cpu32 (sb.level);
-  /* Multipath.  */
-  if ((int) level == -4)
+  /* Multipath or linear  */
+  if ((int) level == -4 || (int) level == -1)
     level = 1;
 
   if (level != 0 && level != 1 && level != 4 &&