From: Richard Laager <rlaager@wiktel.com>
To: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
Cc: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Freeze on 27 February
Date: Tue, 21 Feb 2012 23:35:06 -0600 [thread overview]
Message-ID: <1329888906.16648.134.camel@watermelon.coderich.net> (raw)
In-Reply-To: <4F43C25C.2040106@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2084 bytes --]
On Tue, 2012-02-21 at 17:12 +0100, Vladimir 'φ-coder/phcoder' Serbinenko
wrote:
> @Richard Laager: Which of ZFS patches aren't committed yet? It's a bit
> tricky to see which ones were superseeded.
I've attached my current patch set. The patches apply in the order
listed. They're also roughly ordered by complexity, so I'd recommend
reviewing them in this order.
Also, if you have libzfs, a --disable-zfs or --without-zfs or similar
patch is necessary to ensure that the zpool and zfs commands are used
instead of libzfs.
---- Not ZFS Related:
Previously submitted, no feedback, trivial:
grub-install-whitespace.patch
Not previously submitted, trivial:
bzrignore-updates.patch
---- ZFS Related:
Previously submitted, no feedback:
zfs-poolname-spaces.patch
zfs-devices.patch
Not previously submitted:
zfs-on-linux-rlaager8.patch
With this, you should be able to boot with (native)
ZFS-on-Linux, though you'll have to add whatever rpool
specifiers (if any) required by your initrd.
zfs-on-linux-rlaager9.patch
Part of this is just to support ZFS roots
(root=ZFS=rpool/ROOT/ubuntu, for example).
The other part may need more design work. It moves some
of the btrfs code to inside linux_entry (and likewise,
the ZFS support is added there). Right now, GRUB
supports the concept of multiple kernels. I think that
needs to be extended to multiple root filesystems (in
practice: subvols in btrfs, clones in ZFS). This is the
first step in that process. The missing part is looping
over the additional root filesystems.
Even if we can't get the multiple root filesystems issue figured out,
I'd really love to see everything else make it into the release. It'd be
a huge step in the right direction for those of us working with native
ZFS-on-Linux.
--
Richard
[-- Attachment #1.2: grub-install-whitespace.patch --]
[-- Type: text/x-patch, Size: 1276 bytes --]
Index: grub/ChangeLog.grub-install-whitespace
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ grub/ChangeLog.grub-install-whitespace 2012-02-03 05:52:51.439942000 -0600
@@ -0,0 +1,4 @@
+2012-02-03 Richard Laager <rlaager@wiktel.com>
+
+ * util/grub-install.in: Fix some inconsistent whitespace.
+
Index: grub/util/grub-install.in
===================================================================
--- grub.orig/util/grub-install.in 2012-02-03 05:53:36.039465769 -0600
+++ grub/util/grub-install.in 2012-02-03 05:54:04.771697000 -0600
@@ -486,13 +486,13 @@
# filesystem will be accessible).
partmap_module=
for x in `echo "${grub_device}" | xargs "$grub_probe" --device-map="${device_map}" --target=partmap --device 2> /dev/null`; do
- case "$x" in
- netbsd | openbsd)
- partmap_module="$partmap_module part_bsd";;
- "") ;;
- *)
- partmap_module="$partmap_module part_$x";;
- esac
+ case "$x" in
+ netbsd | openbsd)
+ partmap_module="$partmap_module part_bsd";;
+ "") ;;
+ *)
+ partmap_module="$partmap_module part_$x";;
+ esac
done
# Device abstraction module, if any (lvm, raid).
[-- Attachment #1.3: bzrignore-updates.patch --]
[-- Type: text/x-patch, Size: 633 bytes --]
=== modified file '.bzrignore'
Index: grub/.bzrignore
===================================================================
--- grub.orig/.bzrignore 2012-02-04 17:30:15.295629000 -0600
+++ grub/.bzrignore 2012-02-04 17:30:49.356454000 -0600
@@ -104,6 +104,8 @@ partmap_test
*.pp
po/*.mo
po/grub.pot
+po/POTFILES
+po/stamp-po
stamp-h
stamp-h1
stamp-h.in
@@ -132,8 +134,10 @@ contrib
grub-core/Makefile.core.am
grub-core/Makefile.gcry.def
grub-core/contrib
+grub-core/gdb_grub
grub-core/genmod.sh
grub-core/gensyminfo.sh
+grub-core/gmodule.pl
grub-core/modinfo.sh
grub-core/*.module
grub-core/*.pp
[-- Attachment #1.4: zfs-poolname-spaces.patch --]
[-- Type: text/x-patch, Size: 1099 bytes --]
Handle pool names with spaces
Index: grub/util/getroot.c
===================================================================
--- grub.orig/util/getroot.c 2012-02-03 05:21:06.838056692 -0600
+++ grub/util/getroot.c 2012-02-03 05:22:36.227364000 -0600
@@ -260,7 +260,7 @@
char cksum[257], notes[257];
unsigned int dummy;
- cmd = xasprintf ("zpool status %s", poolname);
+ cmd = xasprintf ("zpool status \"%s\"", poolname);
fp = popen (cmd, "r");
free (cmd);
@@ -285,8 +285,7 @@
st++;
break;
case 1:
- if (!strcmp (name, poolname))
- st++;
+ st++;
break;
case 2:
if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy)
@@ -420,6 +419,9 @@
if (sscanf (sep, "%s %s", entry.fstype, entry.device) != 2)
continue;
+ unescape (entry.fstype);
+ unescape (entry.device);
+
/* Using the mount IDs, find out where this fits in the list of
visible mount entries we've seen so far. There are three
interesting cases. Firstly, it may be inserted at the end: this is
[-- Attachment #1.5: zfs-devices.patch --]
[-- Type: text/x-patch, Size: 593 bytes --]
Handle vdevs with full paths
Index: grub/util/getroot.c
===================================================================
--- grub.orig/util/getroot.c 2012-02-03 05:22:36.227364000 -0600
+++ grub/util/getroot.c 2012-02-03 05:22:41.255135000 -0600
@@ -301,7 +301,10 @@
devices = xrealloc (devices, sizeof (devices[0])
* devices_allocated);
}
- devices[ndevices++] = xasprintf ("/dev/%s", name);
+ if (name[0] == '/')
+ devices[ndevices++] = xstrdup (name);
+ else
+ devices[ndevices++] = xasprintf ("/dev/%s", name);
}
break;
}
[-- Attachment #1.6: zfs-on-linux-rlaager8.patch --]
[-- Type: text/x-patch, Size: 3147 bytes --]
ZFS on Linux Improvements
1. `zpool status` can output disk names which are under /dev/disk.
2. `zpool status` outputs the whole disk device for wholedisk pools,
but GRUB needs the partition device.
3. Support native ZFS on Linux.
Index: grub/util/getroot.c
===================================================================
--- grub.orig/util/getroot.c 2012-02-03 05:54:39.540539000 -0600
+++ grub/util/getroot.c 2012-02-03 06:04:29.465275000 -0600
@@ -304,7 +304,87 @@
if (name[0] == '/')
devices[ndevices++] = xstrdup (name);
else
+#ifdef __linux__
+ {
+ /* The name returned by zpool isn't necessarily directly under /dev. */
+ char *device = xasprintf ("/dev/%s", name);
+ struct stat sb;
+ char *real_device;
+ char *c;
+ char *partition;
+
+ if (stat (device, &sb) != 0)
+ {
+ DIR *dev;
+ struct dirent *subdir;
+
+ free (device);
+ device = NULL;
+ dev = opendir ("/dev/disk");
+ if (dev)
+ {
+ while ((subdir = readdir (dev)))
+ {
+ if (subdir->d_name[0] == '.')
+ continue;
+ if (subdir->d_type == DT_UNKNOWN)
+ {
+ char *subdir_path = xasprintf ("/dev/disk/%s", subdir->d_name);
+ ret = stat (subdir_path, &sb);
+ free (subdir_path);
+ if (ret != 0)
+ continue;
+ if (!S_ISDIR (sb.st_mode))
+ continue;
+ }
+ else if (subdir->d_type != DT_DIR)
+ continue;
+ device = xasprintf ("/dev/disk/%s/%s", subdir->d_name, name);
+ if (stat (device, &sb) == 0)
+ break;
+ else
+ {
+ free (device);
+ device = NULL;
+ }
+ }
+ closedir (dev);
+ if (! device)
+ grub_util_error (_("failed to find device %s"), device);
+ }
+ }
+
+ /* Resolve the symlink to something like /dev/sda. */
+ real_device = canonicalize_file_name (device);
+ if (! real_device)
+ grub_util_error (_("failed to get canonical path of %s"), device);
+ free(device);
+
+ /* It ends in a number; assume it's a partition and stop. */
+ for (c = real_device ; *(c+1) ; c++);
+ if (*c >= '0' && *c <= '9')
+ {
+ devices[ndevices++] = real_device;
+ break;
+ }
+
+ /* Otherwise, it might be a partitioned wholedisk device. */
+ partition = xasprintf ("%s1", real_device);
+ if (stat (partition, &sb) == 0)
+ {
+ free (real_device);
+ devices[ndevices++] = partition;
+ break;
+ }
+ free (partition);
+
+ /* The device is not partitioned. */
+ devices[ndevices++] = real_device;
+ break;
+ }
+#else
devices[ndevices++] = xasprintf ("/dev/%s", name);
+#endif
}
break;
}
@@ -478,7 +558,8 @@
if (!*entries[i].device)
continue;
- if (grub_strcmp (entries[i].fstype, "fuse.zfs") == 0)
+ if (grub_strcmp (entries[i].fstype, "fuse.zfs") == 0 ||
+ grub_strcmp (entries[i].fstype, "zfs") == 0)
{
char *slash;
slash = strchr (entries[i].device, '/');
[-- Attachment #1.7: zfs-on-linux-rlaager9.patch --]
[-- Type: text/x-patch, Size: 2323 bytes --]
Pass boot=zfs and zfs-bootfs=... when / is ZFS on Linux
Index: grub/util/grub.d/10_linux.in
===================================================================
--- grub.orig/util/grub.d/10_linux.in 2012-02-02 03:34:48.512644650 -0600
+++ grub/util/grub.d/10_linux.in 2012-02-03 01:12:57.608355000 -0600
@@ -56,13 +56,11 @@
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
-if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ] \
- || [ "x`stat -f --printf=%T /`" = xbtrfs ]; then
- rootsubvol="`make_system_path_relative_to_its_root /`"
- rootsubvol="${rootsubvol#/}"
- if [ "x${rootsubvol}" != x ]; then
- GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
- fi
+LINUX_ROOT_FS=`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`
+LINUX_ROOT_STAT=`stat -f --printf=%T / || true`
+
+if [ "x${LINUX_ROOT_FS}" = xzfs ]; then
+ RPOOL=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
fi
for word in $GRUB_CMDLINE_LINUX_DEFAULT; do
@@ -193,6 +191,19 @@
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
+ cmdline=""
+ if [ "x${LINUX_ROOT_FS}" = xbtrfs -o "x${LINUX_ROOT_STAT}" = xbtrfs ]; then
+ rootsubvol="`make_system_path_relative_to_its_root /`"
+ rootsubvol="${rootsubvol#/}"
+ if [ "x${rootsubvol}" != x ]; then
+ cmdline="rootflags=subvol=${rootsubvol} ${cmdline}"
+ fi
+ fi
+ if [ "x${LINUX_ROOT_FS}" = xzfs ]; then
+ bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
+ linux_root_device_thisversion="ZFS=${RPOOL}${bootfs}"
+ cmdline="boot=zfs rpool=${RPOOL} bootfs=${RPOOL}${bootfs} ${cmdline}"
+ fi
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
@@ -229,7 +240,7 @@
fi
linux_entry "${OS}" "${version}" false \
- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
+ "${cmdline} ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
quiet
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
if [ -x /lib/recovery-mode/recovery-menu ]; then
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-02-22 5:35 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 16:12 Freeze on 27 February Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-21 16:19 ` Lennart Sorensen
2012-02-21 17:09 ` Lists and aliasing (Re: Freeze on 27 February) Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-21 18:46 ` Lennart Sorensen
2012-02-21 19:58 ` Lennart Sorensen
2012-02-21 20:29 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 15:34 ` Lennart Sorensen
2012-02-22 15:50 ` Lennart Sorensen
2012-02-22 15:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 16:18 ` Lennart Sorensen
2012-02-22 16:25 ` Lennart Sorensen
2012-02-22 16:43 ` Lennart Sorensen
2012-02-22 16:50 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 17:16 ` Lennart Sorensen
2012-02-22 17:35 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 17:41 ` Lennart Sorensen
2012-02-22 17:46 ` Lennart Sorensen
2012-02-22 18:01 ` Lennart Sorensen
2012-02-22 18:28 ` Lennart Sorensen
2012-02-22 18:41 ` Lennart Sorensen
2012-02-22 19:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-22 22:50 ` Lennart Sorensen
2012-02-22 23:03 ` Lennart Sorensen
2012-02-23 2:39 ` Isaac Dupree
2012-02-23 6:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-23 17:43 ` Lennart Sorensen
2012-02-24 23:16 ` Lennart Sorensen
2012-02-22 17:38 ` Lennart Sorensen
2012-02-22 16:51 ` Lennart Sorensen
2012-02-21 21:40 ` Lennart Sorensen
2012-02-22 5:35 ` Richard Laager [this message]
2012-02-23 6:34 ` Freeze on 27 February Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27 6:58 ` Richard Laager
2012-02-27 18:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27 7:32 ` Richard Laager
[not found] ` <1330033617.3895.26.camel@watermelon.coderich.net>
[not found] ` <4F4AC782.1090402@gmail.com>
[not found] ` <1330322499.2901.5.camel@watermelon.coderich.net>
[not found] ` <1330322681.2901.8.camel@watermelon.coderich.net>
2012-02-27 18:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27 18:20 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-27 19:46 ` Richard Laager
2012-03-08 22:51 ` Remaining ZFS Changes for 2.00 (Was: Re: Freeze on 27 February) Richard Laager
2012-03-10 12:44 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 13:39 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 15:51 ` Richard Laager
2012-03-10 16:01 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 13:41 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-10 17:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1329888906.16648.134.camel@watermelon.coderich.net \
--to=rlaager@wiktel.com \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.