All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: Richard Laager <rlaager@wiktel.com>
Cc: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Freeze on 27 February
Date: Thu, 23 Feb 2012 07:34:24 +0100	[thread overview]
Message-ID: <4F45DDF0.2090908@gmail.com> (raw)
In-Reply-To: <1329888906.16648.134.camel@watermelon.coderich.net>

On 22.02.2012 06:35, Richard Laager wrote:
> 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
>
>
> bzrignore-updates.patch
>
>
> === 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
>
Committed
> zfs-poolname-spaces.patch
>
>
> 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");
This is wrong if poolname contains weird characters. Can you make it 
similar to mdadm-related code?
>     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);
> +
You need to increase the size of storage for these fields.
>
> 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;
>   	  }
>
This one is ok other than the missing ChangeLog.
> zfs-on-linux-rlaager8.patch
>
>
> 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);
Could you unify this with the scan code we already have? (the one where 
we scan for major/minor)

@@ -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, '/');
This should go as a separate patch

>
> zfs-on-linux-rlaager9.patch
>
>
> 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
Please keep this at the beginning, we don't need to execute it for every 
kernel.
>
>     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


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



  reply	other threads:[~2012-02-23  6:34 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 ` Freeze on 27 February Richard Laager
2012-02-23  6:34   ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
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=4F45DDF0.2090908@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=rlaager@wiktel.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.