* [PATCH] Software RAID (fakeraid) support for Linux device mapper
@ 2010-07-14 16:52 Raphael Bossek
2010-07-20 13:35 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 6+ messages in thread
From: Raphael Bossek @ 2010-07-14 16:52 UTC (permalink / raw)
To: grub-devel; +Cc: Colin Watson
[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]
Hi folks,
I'm using Debian GNU/Linux "squeeze/sid" with Linux
2.6.32-5-686-bigmem were my two harddisks are configured in Software
RAID (aka faikraid).
Because faikraid did not work for me especialy since udev version 158
where /dev/mapper/pdc_* are symlinked to /dev/dm-* nodes I tried
myself in coding GRUB and fixed all my issues with the applied patches
(based on 1.98 bzr 20100710 as provided by Debian; 1.98+20100710-1).
1) zcat bossekr-mdraidorlvm.patch.gz | patch -p1
2) zcat bossekr-fakeraid.patch | patch -p1
The solution was to improve the support for /dev/dm- device nodes.
Greetings,
Raphael Bossek
Here some additional information about my setup:
$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-2.6.32-5-686-bigmem
root=UUID=081cf388-6820-4843-a4d5-9f0d4be424ef ro quiet splash
$ cat /proc/self/mountinfo
14 19 0:0 / /sys rw,nosuid,nodev,noexec,relatime - sysfs none rw
15 19 0:3 / /proc rw,nosuid,nodev,noexec,relatime - proc none rw
16 19 0:5 / /dev rw,relatime - devtmpfs none
rw,size=2064088k,nr_inodes=212971,mode=755
17 16 0:11 / /dev/pts rw,nosuid,noexec,relatime - devpts none
rw,gid=5,mode=620,ptmxmode=000
19 1 254:3 / / rw,relatime - ext4
/dev/disk/by-uuid/081cf388-6820-4843-a4d5-9f0d4be424ef
rw,errors=remount-ro,barrier=1,data=ordered
20 19 0:15 / /lib/init/rw rw,nosuid,relatime - tmpfs tmpfs rw,mode=755
21 16 0:16 / /dev/shm rw,nosuid,nodev,relatime - tmpfs tmpfs rw
23 19 0:17 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs rpc_pipefs rw
24 14 0:18 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
25 15 0:19 / /proc/fs/nfsd rw,relatime - nfsd nfsd rw
26 15 0:20 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime
- binfmt_misc binfmt_misc rw
$ ls -1l /dev/mapper/
crw------- 1 root root 10, 59 Jul 14 12:56 control
lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh -> ../dm-0
lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh1 -> ../dm-1
lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh2 -> ../dm-2
lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh3 -> ../dm-3
$ ls -1l /dev/dm-*
brw-rw---- 1 root disk 254, 0 14. Jul 11:45 /dev/dm-0
brw-rw---- 1 root disk 254, 1 14. Jul 10:56 /dev/dm-1
brw-rw---- 1 root disk 254, 2 14. Jul 10:56 /dev/dm-2
brw-rw---- 1 root disk 254, 3 14. Jul 10:56 /dev/dm-3
[-- Attachment #2: bossekr-fakeraid.patch.gz --]
[-- Type: application/x-gzip, Size: 1155 bytes --]
[-- Attachment #3: bossekr-mdraidorlvm.patch.gz --]
[-- Type: application/x-gzip, Size: 518 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Software RAID (fakeraid) support for Linux device mapper
2010-07-14 16:52 [PATCH] Software RAID (fakeraid) support for Linux device mapper Raphael Bossek
@ 2010-07-20 13:35 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-07-22 19:59 ` Raphael Bossek
0 siblings, 1 reply; 6+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-07-20 13:35 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 3769 bytes --]
On 07/14/2010 06:52 PM, Raphael Bossek wrote:
> Hi folks,
>
> I'm using Debian GNU/Linux "squeeze/sid" with Linux
> 2.6.32-5-686-bigmem were my two harddisks are configured in Software
> RAID (aka faikraid).
> Because faikraid did not work for me especialy since udev version 158
> where /dev/mapper/pdc_* are symlinked to /dev/dm-* nodes I tried
> myself in coding GRUB and fixed all my issues with the applied patches
> (based on 1.98 bzr 20100710 as provided by Debian; 1.98+20100710-1).
>
> 1) zcat bossekr-mdraidorlvm.patch.gz | patch -p1
> 2) zcat bossekr-fakeraid.patch | patch -p1
>
>
Please avoid compressing patches. Perhaps it saved you 0.1 seconds of
transfer time but it delayed the review because it's so annoying to have
to exit from mailer for this.
static int
-grub_util_is_dmraid (const char *os_dev)
+grub_util_is_lvm (const char *os_dev)
{
if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
return 1;
nvidia_ isn't lvm-related. Why do you want to name it lvm?
- if (!strncmp (os_dev, "/dev/md", 7))
+ if (grub_util_is_mdraid (os_dev))
Since this function isn't reused it only increases number of lines of code.
+ if (! realpath (os_dev, path))
+ return 1;
We use realpath (os_dev, NULL);
+
+ return ! strncmp (path, "/dev/dm-", 8);
This check fails if devices in mapper aren't symlinks. Aren't there any
better way using libraries?
+#ifdef HAVE_DEVICE_MAPPER
+ GRUB_DEV_ABSTRACTION_DM,
+#else
+ GRUB_DEV_ABSTRACTION_DM_RESERVE_THIS_VALUE_NOTFORUSE,
+#endif
Why do you need distinguish dm from mdraid. In any case #if is useless:
just use:
+ GRUB_DEV_ABSTRACTION_DM,
> The solution was to improve the support for /dev/dm- device nodes.
>
> Greetings,
> Raphael Bossek
>
> Here some additional information about my setup:
>
> $ cat /proc/cmdline
> BOOT_IMAGE=/boot/vmlinuz-2.6.32-5-686-bigmem
> root=UUID=081cf388-6820-4843-a4d5-9f0d4be424ef ro quiet splash
>
> $ cat /proc/self/mountinfo
> 14 19 0:0 / /sys rw,nosuid,nodev,noexec,relatime - sysfs none rw
> 15 19 0:3 / /proc rw,nosuid,nodev,noexec,relatime - proc none rw
> 16 19 0:5 / /dev rw,relatime - devtmpfs none
> rw,size=2064088k,nr_inodes=212971,mode=755
> 17 16 0:11 / /dev/pts rw,nosuid,noexec,relatime - devpts none
> rw,gid=5,mode=620,ptmxmode=000
> 19 1 254:3 / / rw,relatime - ext4
> /dev/disk/by-uuid/081cf388-6820-4843-a4d5-9f0d4be424ef
> rw,errors=remount-ro,barrier=1,data=ordered
> 20 19 0:15 / /lib/init/rw rw,nosuid,relatime - tmpfs tmpfs rw,mode=755
> 21 16 0:16 / /dev/shm rw,nosuid,nodev,relatime - tmpfs tmpfs rw
> 23 19 0:17 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs rpc_pipefs rw
> 24 14 0:18 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
> 25 15 0:19 / /proc/fs/nfsd rw,relatime - nfsd nfsd rw
> 26 15 0:20 / /proc/sys/fs/binfmt_misc rw,nosuid,nodev,noexec,relatime
> - binfmt_misc binfmt_misc rw
>
> $ ls -1l /dev/mapper/
> crw------- 1 root root 10, 59 Jul 14 12:56 control
> lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh -> ../dm-0
> lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh1 -> ../dm-1
> lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh2 -> ../dm-2
> lrwxrwxrwx 1 root root 7 Jul 14 12:56 pdc_fcgchefh3 -> ../dm-3
>
> $ ls -1l /dev/dm-*
> brw-rw---- 1 root disk 254, 0 14. Jul 11:45 /dev/dm-0
> brw-rw---- 1 root disk 254, 1 14. Jul 10:56 /dev/dm-1
> brw-rw---- 1 root disk 254, 2 14. Jul 10:56 /dev/dm-2
> brw-rw---- 1 root disk 254, 3 14. Jul 10:56 /dev/dm-3
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Software RAID (fakeraid) support for Linux device mapper
2010-07-20 13:35 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-07-22 19:59 ` Raphael Bossek
2010-07-27 10:00 ` Raphael Bossek
0 siblings, 1 reply; 6+ messages in thread
From: Raphael Bossek @ 2010-07-22 19:59 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: phcoder
2010/7/20 Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>:
> Please avoid compressing patches. Perhaps it saved you 0.1 seconds of
> transfer time but it delayed the review because it's so annoying to have
> to exit from mailer for this.
Ok, next time.
> static int
> -grub_util_is_dmraid (const char *os_dev)
> +grub_util_is_lvm (const char *os_dev)
> {
> if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
> return 1;
> nvidia_ isn't lvm-related. Why do you want to name it lvm?
confirmed
> - if (!strncmp (os_dev, "/dev/md", 7))
> + if (grub_util_is_mdraid (os_dev))
> Since this function isn't reused it only increases number of lines of code.
confirmed
> + if (! realpath (os_dev, path))
> + return 1;
> We use realpath (os_dev, NULL);
Ok, I'll change this.
> +
> + return ! strncmp (path, "/dev/dm-", 8);
> This check fails if devices in mapper aren't symlinks. Aren't there any
> better way using libraries?
I'll check the API from devicemapper library. Maybe udev, I do not
know right yet.
> +#ifdef HAVE_DEVICE_MAPPER
> + GRUB_DEV_ABSTRACTION_DM,
> +#else
> + GRUB_DEV_ABSTRACTION_DM_RESERVE_THIS_VALUE_NOTFORUSE,
> +#endif
> Why do you need distinguish dm from mdraid. In any case #if is useless:
> just use:
> + GRUB_DEV_ABSTRACTION_DM,
Ok, I'll remove this.
I intent to recreate the patch based on an a new release of grub2 for Debian.
Greetings,
Raphael
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Software RAID (fakeraid) support for Linux device mapper
2010-07-22 19:59 ` Raphael Bossek
@ 2010-07-27 10:00 ` Raphael Bossek
2010-08-05 8:34 ` Raphael Bossek
0 siblings, 1 reply; 6+ messages in thread
From: Raphael Bossek @ 2010-07-27 10:00 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: phcoder, Colin Watson
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
Hi Vladimir,
here an another try. I hope it's better now ;-) Open for you feedback.
If it's ok it would be nice if one of you could commit this patch to
bazaar for me.
Greetings,
Raphael
[-- Attachment #2: bossekr-fakeraid20100727.patch --]
[-- Type: text/x-diff, Size: 2611 bytes --]
# HG changeset patch
# Parent 1019176187e9f766af7b3940c307964ffdb09e80
diff -r 1019176187e9 include/grub/emu/misc.h
--- a/include/grub/emu/misc.h Tue Jul 27 09:59:43 2010 +0200
+++ b/include/grub/emu/misc.h Tue Jul 27 11:51:36 2010 +0200
@@ -51,5 +51,6 @@
#ifdef HAVE_DEVICE_MAPPER
int grub_device_mapper_supported (void);
#endif
+int device_is_mapped (const char *dev);
#endif /* GRUB_EMU_MISC_H */
diff -r 1019176187e9 kern/emu/getroot.c
--- a/kern/emu/getroot.c Tue Jul 27 09:59:43 2010 +0200
+++ b/kern/emu/getroot.c Tue Jul 27 11:51:36 2010 +0200
@@ -139,9 +139,6 @@
free (ret);
ret = NULL;
- if (major != 0)
- continue; /* not a virtual device */
-
sep = strstr (buf + count, " - ");
if (!sep)
continue;
@@ -156,6 +153,9 @@
if (!S_ISBLK (st.st_mode))
continue; /* not a block device */
+ if (major != 0 && ! device_is_mapped (device))
+ continue; /* not a virtual device */
+
ret = strdup (device);
}
diff -r 1019176187e9 kern/emu/hostdisk.c
--- a/kern/emu/hostdisk.c Tue Jul 27 09:59:43 2010 +0200
+++ b/kern/emu/hostdisk.c Tue Jul 27 11:51:36 2010 +0200
@@ -316,19 +316,6 @@
return GRUB_ERR_NONE;
}
-#ifdef HAVE_DEVICE_MAPPER
-static int
-device_is_mapped (const char *dev)
-{
- struct stat st;
-
- if (stat (dev, &st) < 0)
- return 0;
-
- return dm_is_dm_major (major (st.st_rdev));
-}
-#endif /* HAVE_DEVICE_MAPPER */
-
#if defined(__linux__) || defined(__CYGWIN__) || defined(__NetBSD__)
static grub_disk_addr_t
find_partition_start (const char *dev)
@@ -342,7 +329,7 @@
# endif /* !defined(__NetBSD__) */
# ifdef HAVE_DEVICE_MAPPER
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
+ if (device_is_mapped (dev)) {
struct dm_task *task = NULL;
grub_uint64_t start, length;
char *target_type, *params, *space;
@@ -1145,7 +1132,7 @@
#ifdef HAVE_DEVICE_MAPPER
/* If this is a DM-RAID device. */
- if ((strncmp ("mapper/", p, 7) == 0))
+ if (device_is_mapped (path))
{
static struct dm_tree *tree = NULL;
uint32_t maj, min;
diff -r 1019176187e9 kern/emu/misc.c
--- a/kern/emu/misc.c Tue Jul 27 09:59:43 2010 +0200
+++ b/kern/emu/misc.c Tue Jul 27 11:51:36 2010 +0200
@@ -350,3 +350,21 @@
return supported;
}
#endif /* HAVE_DEVICE_MAPPER */
+
+int
+device_is_mapped (const char *dev)
+{
+#ifdef HAVE_DEVICE_MAPPER
+ struct stat st;
+
+ if (! grub_device_mapper_supported ())
+ return 0;
+
+ if (stat (dev, &st) < 0)
+ return 0;
+
+ return dm_is_dm_major (major (st.st_rdev));
+#else
+ return 0;
+#endif /* HAVE_DEVICE_MAPPER */
+}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Software RAID (fakeraid) support for Linux device mapper
2010-07-27 10:00 ` Raphael Bossek
@ 2010-08-05 8:34 ` Raphael Bossek
2010-09-16 10:36 ` Colin Watson
0 siblings, 1 reply; 6+ messages in thread
From: Raphael Bossek @ 2010-08-05 8:34 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: phcoder, Colin Watson
[-- Attachment #1: Type: text/plain, Size: 2925 bytes --]
Hi GRUB-developers,
here an update of my patch which apply clean with Colin's Debian
1.98+20100804 release.
Coments are welcome in hope my modification will be applied upstream
because I've to do this for my confing each time Colin release a new
version of grub2 for Debian ;-)
--->8--->8--->8--->8--->8--->8--->8---
diff -r 1de1becf5f1b include/grub/emu/misc.h
--- a/include/grub/emu/misc.h Thu Aug 05 10:27:19 2010 +0200
+++ b/include/grub/emu/misc.h Thu Aug 05 10:29:04 2010 +0200
@@ -36,6 +36,7 @@
#else
# define DEFAULT_DIRECTORY "/boot/grub"
#endif
+int device_is_mapped (const char *dev);
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
diff -r 1de1becf5f1b kern/emu/getroot.c
--- a/kern/emu/getroot.c Thu Aug 05 10:27:19 2010 +0200
+++ b/kern/emu/getroot.c Thu Aug 05 10:29:04 2010 +0200
@@ -147,9 +147,6 @@
free (ret);
ret = NULL;
- if (major != 0)
- continue; /* not a virtual device */
-
sep = strstr (buf + count, " - ");
if (!sep)
continue;
@@ -164,6 +161,9 @@
if (!S_ISBLK (st.st_mode))
continue; /* not a block device */
+ if (major != 0 && ! device_is_mapped (device))
+ continue; /* not a virtual device */
+
ret = strdup (device);
}
diff -r 1de1becf5f1b kern/emu/hostdisk.c
--- a/kern/emu/hostdisk.c Thu Aug 05 10:27:19 2010 +0200
+++ b/kern/emu/hostdisk.c Thu Aug 05 10:29:04 2010 +0200
@@ -316,19 +316,6 @@
return GRUB_ERR_NONE;
}
-#ifdef HAVE_DEVICE_MAPPER
-static int
-device_is_mapped (const char *dev)
-{
- struct stat st;
-
- if (stat (dev, &st) < 0)
- return 0;
-
- return dm_is_dm_major (major (st.st_rdev));
-}
-#endif /* HAVE_DEVICE_MAPPER */
-
#if defined(__linux__) || defined(__CYGWIN__) || defined(__NetBSD__)
static grub_disk_addr_t
find_partition_start (const char *dev)
@@ -342,7 +329,7 @@
# endif /* !defined(__NetBSD__) */
# ifdef HAVE_DEVICE_MAPPER
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
+ if (device_is_mapped (dev)) {
struct dm_task *task = NULL;
grub_uint64_t start, length;
char *target_type, *params, *space;
@@ -1145,7 +1132,7 @@
#ifdef HAVE_DEVICE_MAPPER
/* If this is a DM-RAID device. */
- if ((strncmp ("mapper/", p, 7) == 0))
+ if (device_is_mapped (path))
{
static struct dm_tree *tree = NULL;
uint32_t maj, min;
diff -r 1de1becf5f1b kern/emu/misc.c
--- a/kern/emu/misc.c Thu Aug 05 10:27:19 2010 +0200
+++ b/kern/emu/misc.c Thu Aug 05 10:29:04 2010 +0200
@@ -551,3 +551,21 @@
return supported;
}
#endif /* HAVE_DEVICE_MAPPER */
+
+int
+device_is_mapped (const char *dev)
+{
+#ifdef HAVE_DEVICE_MAPPER
+ struct stat st;
+
+ if (! grub_device_mapper_supported ())
+ return 0;
+
+ if (stat (dev, &st) < 0)
+ return 0;
+
+ return dm_is_dm_major (major (st.st_rdev));
+#else
+ return 0;
+#endif /* HAVE_DEVICE_MAPPER */
+}
---8<---8<---8<---8<---8<---8<---8<---8<---
Greetings,
Raphael
[-- Attachment #2: bossekr-fakeraid.patch --]
[-- Type: text/x-diff, Size: 2622 bytes --]
# HG changeset patch
# Parent 1de1becf5f1b781bac2a71a1dabe85d5814b4657
diff -r 1de1becf5f1b include/grub/emu/misc.h
--- a/include/grub/emu/misc.h Thu Aug 05 10:27:19 2010 +0200
+++ b/include/grub/emu/misc.h Thu Aug 05 10:29:04 2010 +0200
@@ -36,6 +36,7 @@
#else
# define DEFAULT_DIRECTORY "/boot/grub"
#endif
+int device_is_mapped (const char *dev);
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
diff -r 1de1becf5f1b kern/emu/getroot.c
--- a/kern/emu/getroot.c Thu Aug 05 10:27:19 2010 +0200
+++ b/kern/emu/getroot.c Thu Aug 05 10:29:04 2010 +0200
@@ -147,9 +147,6 @@
free (ret);
ret = NULL;
- if (major != 0)
- continue; /* not a virtual device */
-
sep = strstr (buf + count, " - ");
if (!sep)
continue;
@@ -164,6 +161,9 @@
if (!S_ISBLK (st.st_mode))
continue; /* not a block device */
+ if (major != 0 && ! device_is_mapped (device))
+ continue; /* not a virtual device */
+
ret = strdup (device);
}
diff -r 1de1becf5f1b kern/emu/hostdisk.c
--- a/kern/emu/hostdisk.c Thu Aug 05 10:27:19 2010 +0200
+++ b/kern/emu/hostdisk.c Thu Aug 05 10:29:04 2010 +0200
@@ -316,19 +316,6 @@
return GRUB_ERR_NONE;
}
-#ifdef HAVE_DEVICE_MAPPER
-static int
-device_is_mapped (const char *dev)
-{
- struct stat st;
-
- if (stat (dev, &st) < 0)
- return 0;
-
- return dm_is_dm_major (major (st.st_rdev));
-}
-#endif /* HAVE_DEVICE_MAPPER */
-
#if defined(__linux__) || defined(__CYGWIN__) || defined(__NetBSD__)
static grub_disk_addr_t
find_partition_start (const char *dev)
@@ -342,7 +329,7 @@
# endif /* !defined(__NetBSD__) */
# ifdef HAVE_DEVICE_MAPPER
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
+ if (device_is_mapped (dev)) {
struct dm_task *task = NULL;
grub_uint64_t start, length;
char *target_type, *params, *space;
@@ -1145,7 +1132,7 @@
#ifdef HAVE_DEVICE_MAPPER
/* If this is a DM-RAID device. */
- if ((strncmp ("mapper/", p, 7) == 0))
+ if (device_is_mapped (path))
{
static struct dm_tree *tree = NULL;
uint32_t maj, min;
diff -r 1de1becf5f1b kern/emu/misc.c
--- a/kern/emu/misc.c Thu Aug 05 10:27:19 2010 +0200
+++ b/kern/emu/misc.c Thu Aug 05 10:29:04 2010 +0200
@@ -551,3 +551,21 @@
return supported;
}
#endif /* HAVE_DEVICE_MAPPER */
+
+int
+device_is_mapped (const char *dev)
+{
+#ifdef HAVE_DEVICE_MAPPER
+ struct stat st;
+
+ if (! grub_device_mapper_supported ())
+ return 0;
+
+ if (stat (dev, &st) < 0)
+ return 0;
+
+ return dm_is_dm_major (major (st.st_rdev));
+#else
+ return 0;
+#endif /* HAVE_DEVICE_MAPPER */
+}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Software RAID (fakeraid) support for Linux device mapper
2010-08-05 8:34 ` Raphael Bossek
@ 2010-09-16 10:36 ` Colin Watson
0 siblings, 0 replies; 6+ messages in thread
From: Colin Watson @ 2010-09-16 10:36 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: phcoder
On Thu, Aug 05, 2010 at 10:34:48AM +0200, Raphael Bossek wrote:
> here an update of my patch which apply clean with Colin's Debian
> 1.98+20100804 release.
> Coments are welcome in hope my modification will be applied upstream
> because I've to do this for my confing each time Colin release a new
> version of grub2 for Debian ;-)
I can't work out how this actually fixes anything for you, to be honest.
> diff -r 1de1becf5f1b kern/emu/getroot.c
> --- a/kern/emu/getroot.c Thu Aug 05 10:27:19 2010 +0200
> +++ b/kern/emu/getroot.c Thu Aug 05 10:29:04 2010 +0200
> @@ -147,9 +147,6 @@
> free (ret);
> ret = NULL;
>
> - if (major != 0)
> - continue; /* not a virtual device */
> -
> sep = strstr (buf + count, " - ");
> if (!sep)
> continue;
> @@ -164,6 +161,9 @@
> if (!S_ISBLK (st.st_mode))
> continue; /* not a block device */
>
> + if (major != 0 && ! device_is_mapped (device))
> + continue; /* not a virtual device */
> +
> ret = strdup (device);
> }
>
This is in the function find_root_device_from_mountinfo, which is only
supposed to be used for btrfs. The restriction to virtual devices is
deliberate, because it's hard to find anything else for btrfs. Allowing
mapped devices as well is a significant change in behaviour, and I would
rather not do this. Mapped devices should be handled using
find_root_device, not find_root_device_from_mountinfo. If
find_root_device isn't working, please fix that instead.
> #ifdef HAVE_DEVICE_MAPPER
> /* If this is a DM-RAID device. */
> - if ((strncmp ("mapper/", p, 7) == 0))
> + if (device_is_mapped (path))
> {
> static struct dm_tree *tree = NULL;
> uint32_t maj, min;
I don't know if I'd call this wrong as such, but the rest of this
sequence of conditionals operates on filenames so it seems rather out of
style. I'd prefer to stick to the previous version.
Please include ChangeLog entries with your patches in future so that we
have an explanation of what they're trying to fix. I think this one
should be done differently, though.
(There are a couple of other DM-RAID-related patches floating around
too.)
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-16 10:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-14 16:52 [PATCH] Software RAID (fakeraid) support for Linux device mapper Raphael Bossek
2010-07-20 13:35 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-07-22 19:59 ` Raphael Bossek
2010-07-27 10:00 ` Raphael Bossek
2010-08-05 8:34 ` Raphael Bossek
2010-09-16 10:36 ` Colin Watson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.