grub-2.02_beta2-lvm2-raid1.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From: Andrei Borzenkov <arvidjaar@gmail.com>
  2. Date: Thu, 19 Mar 2015 18:30:27 +0000 (+0300)
  3. Subject: core: add LVM RAID1 support
  4. X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff_plain;h=527eeeeee6c8d3d8e3bb1fac408d47bb1dcbec95;hp=7c9309e50a124817e67de38b30c6291acecad560
  5. core: add LVM RAID1 support
  6. Closes 44534.
  7. ---
  8. diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
  9. index 1e7f197..9b97004 100644
  10. --- a/grub-core/disk/lvm.c
  11. +++ b/grub-core/disk/lvm.c
  12. @@ -577,13 +577,17 @@ grub_lvm_detect (grub_disk_t disk,
  13. if (is_pvmove)
  14. seg->node_count = 1;
  15. }
  16. - else if (grub_memcmp (p, "raid", sizeof ("raid") - 1)
  17. - == 0 && (p[sizeof ("raid") - 1] >= '4'
  18. - && p[sizeof ("raid") - 1] <= '6')
  19. + else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) == 0
  20. + && ((p[sizeof ("raid") - 1] >= '4'
  21. + && p[sizeof ("raid") - 1] <= '6')
  22. + || p[sizeof ("raid") - 1] == '1')
  23. && p[sizeof ("raidX") - 1] == '"')
  24. {
  25. switch (p[sizeof ("raid") - 1])
  26. {
  27. + case '1':
  28. + seg->type = GRUB_DISKFILTER_MIRROR;
  29. + break;
  30. case '4':
  31. seg->type = GRUB_DISKFILTER_RAID4;
  32. seg->layout = GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC;
  33. @@ -608,16 +612,18 @@ grub_lvm_detect (grub_disk_t disk,
  34. goto lvs_segment_fail;
  35. }
  36. - seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
  37. - if (p == NULL)
  38. + if (seg->type != GRUB_DISKFILTER_MIRROR)
  39. {
  40. + seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
  41. + if (p == NULL)
  42. + {
  43. #ifdef GRUB_UTIL
  44. - grub_util_info ("unknown stripe_size\n");
  45. + grub_util_info ("unknown stripe_size\n");
  46. #endif
  47. - goto lvs_segment_fail;
  48. + goto lvs_segment_fail;
  49. + }
  50. }
  51. -
  52. seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
  53. * seg->node_count);
  54. @@ -625,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk,
  55. if (p == NULL)
  56. {
  57. #ifdef GRUB_UTIL
  58. - grub_util_info ("unknown mirrors\n");
  59. + grub_util_info ("unknown raids\n");
  60. #endif
  61. goto lvs_segment_fail2;
  62. }