Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UZMuo-00087A-UB for mharc-grub-devel@gnu.org; Mon, 06 May 2013 11:01:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZMuk-000804-4Z for grub-devel@gnu.org; Mon, 06 May 2013 11:01:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZMuc-0000UT-Kn for grub-devel@gnu.org; Mon, 06 May 2013 11:01:18 -0400 Received: from mmserver.massimo-maggi.eu ([94.23.66.90]:53662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZMuc-0000Tv-7u for grub-devel@gnu.org; Mon, 06 May 2013 11:01:10 -0400 Received: from [IPv6:2001:b05:f:ffff::25] (unknown [IPv6:2001:b05:f:ffff::25]) by mmserver.massimo-maggi.eu (Postfix) with ESMTPSA id 7A5103A8; Mon, 6 May 2013 17:01:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=massimo-maggi.eu; s=mmserver; t=1367852467; bh=0/2JifUPV9Z6olV6jyFVqJu9F88IlG7FJF3G1+pzj3k=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=C6xthOPfaYzG+KSHkcK+x/ShlpPIyRlD/aY0SmPsDkNPqsv0v93UPNj+/ZOdAAweu Xxmc7g2QfbpHbZsGGSciRPHCN52k0QGsJWmkETEaxaQPnESkXb1UefO6MvRcfZTKk3 /c378eYhIDOqXi4/jDjT/KMT8BvIxIUbpEFxgDPM= Message-ID: <5187C6B6.1060709@massimo-maggi.eu> Date: Mon, 06 May 2013 17:05:26 +0200 From: Massimo Maggi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130505 Thunderbird/17.0.5 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH 1/5] Fix reporting of RAIDZ vdevs in zfsinfo References: <510F96B1.6080509@massimo-maggi.eu> <5185928A.9060905@gmail.com> In-Reply-To: <5185928A.9060905@gmail.com> X-Enigmail-Version: 1.6a1pre Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2BTLRBVLHUULVADDUPXOB" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 94.23.66.90 Cc: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 May 2013 15:01:22 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2BTLRBVLHUULVADDUPXOB Content-Type: multipart/mixed; boundary="------------080006010109020308010202" This is a multi-part message in MIME format. --------------080006010109020308010202 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I confirm that the patch attached to this message was written by me without copying/porting/ other code. A commit message for this single patch could be: The ZFS code actually present in GRUB2 is able to correctly read from RAID-Z vdev's, but zfsinfo reports them as unknown vdev's. This commit fixes zfsinfo to correctly report informations about RAID-Z vdev's. Regards, Massimo Maggi On 05/05/2013 00:58, Vladimir '=CF=86-coder/phcoder' Serbinenko wrote: > The patches look ok. The patches it's based on look like original work.= > However your patches are corrupted by your mailer beyond recovery. Can > you resend them as attachements with changelog mentionning the origin? >=20 > On 04.02.2013 12:08, Massimo Maggi wrote: >=20 >> Author: Massimo Maggi >> --- >> grub-core/fs/zfs/zfsinfo.c | 20 +++++++++++++++----- >> 1 file changed, 15 insertions(+), 5 deletions(-) >> >> diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c >> index fdb587a..c96bf21 100644 >> --- a/grub-core/fs/zfs/zfsinfo.c >> +++ b/grub-core/fs/zfs/zfsinfo.c >> @@ -132,21 +132,31 @@ print_vdev_info (char *nvlist, int tab) >> grub_free (path); >> return GRUB_ERR_NONE; >> } >> + char is_mirror=3D(grub_strcmp(type,VDEV_TYPE_MIRROR) =3D=3D 0); >> + char is_raidz=3D(grub_strcmp(type,VDEV_TYPE_RAIDZ) =3D=3D 0); >> - if (grub_strcmp (type, VDEV_TYPE_MIRROR) =3D=3D 0) >> + if (is_mirror || is_raidz) >> { >> int nelm, i; >> nelm =3D grub_zfs_nvlist_lookup_nvlist_array_get_nelm >> (nvlist, ZPOOL_CONFIG_CHILDREN); >> + if(is_mirror){ >> + grub_puts_ (N_("This VDEV is a mirror")); >> + } >> + else if(is_raidz){ >> + grub_uint64_t parity; >> + grub_zfs_nvlist_lookup_uint64(nvlist,"nparity",&parity); >> + grub_printf_ (N_("This VDEV is a RAIDZ%llu\n"),(unsigned long >> long)parity); >> + } >> print_tabs (tab); >> if (nelm <=3D 0) >> { >> - grub_puts_ (N_("Incorrect mirror")); >> + grub_puts_ (N_("Incorrect VDEV")); >> return GRUB_ERR_NONE; >> } >> - grub_printf_ (N_("Mirror with %d children\n"), nelm); >> + grub_printf_ (N_("VDEV with %d children\n"), nelm); >> print_state (nvlist, tab); >> for (i =3D 0; i < nelm; i++) >> { >> @@ -162,14 +172,14 @@ print_vdev_info (char *nvlist, int tab) >> total element number. And the number itself is fine, >> only the element isn't. >> */ >> - grub_printf_ (N_("Mirror element number %d isn't correct\n"), = i); >> + grub_printf_ (N_("VDEV element number %d isn't correct\n"), i)= ; >> continue; >> } >> /* TRANSLATORS: it's the element carying the number %d, not >> total element number. This is used in enumeration >> "Element number 1", "Element number 2", ... */ >> - grub_printf_ (N_("Mirror element number %d:\n"), i); >> + grub_printf_ (N_("VDEV element number %d:\n"), i); >> print_vdev_info (child, tab + 1); >> grub_free (child); >> >> >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel >=20 >=20 >=20 --------------080006010109020308010202 Content-Type: text/x-patch; name="0001-Fix-reporting-of-RAIDZ-vdevs-in-zfsinfo.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Fix-reporting-of-RAIDZ-vdevs-in-zfsinfo.patch" diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c index fdb587a..c96bf21 100644 --- a/grub-core/fs/zfs/zfsinfo.c +++ b/grub-core/fs/zfs/zfsinfo.c @@ -132,21 +132,31 @@ print_vdev_info (char *nvlist, int tab) grub_free (path); return GRUB_ERR_NONE; } + char is_mirror=3D(grub_strcmp(type,VDEV_TYPE_MIRROR) =3D=3D 0); + char is_raidz=3D(grub_strcmp(type,VDEV_TYPE_RAIDZ) =3D=3D 0); =20 - if (grub_strcmp (type, VDEV_TYPE_MIRROR) =3D=3D 0) + if (is_mirror || is_raidz) { int nelm, i; =20 nelm =3D grub_zfs_nvlist_lookup_nvlist_array_get_nelm (nvlist, ZPOOL_CONFIG_CHILDREN); =20 + if(is_mirror){ + grub_puts_ (N_("This VDEV is a mirror")); + } + else if(is_raidz){ + grub_uint64_t parity; + grub_zfs_nvlist_lookup_uint64(nvlist,"nparity",&parity); + grub_printf_ (N_("This VDEV is a RAIDZ%llu\n"),(unsigned long long)par= ity); + } print_tabs (tab); if (nelm <=3D 0) { - grub_puts_ (N_("Incorrect mirror")); + grub_puts_ (N_("Incorrect VDEV")); return GRUB_ERR_NONE; } - grub_printf_ (N_("Mirror with %d children\n"), nelm); + grub_printf_ (N_("VDEV with %d children\n"), nelm); print_state (nvlist, tab); for (i =3D 0; i < nelm; i++) { @@ -162,14 +172,14 @@ print_vdev_info (char *nvlist, int tab) total element number. And the number itself is fine, only the element isn't. */ - grub_printf_ (N_("Mirror element number %d isn't correct\n"), i);= + grub_printf_ (N_("VDEV element number %d isn't correct\n"), i); continue; } =20 /* TRANSLATORS: it's the element carying the number %d, not total element number. This is used in enumeration "Element number 1", "Element number 2", ... */ - grub_printf_ (N_("Mirror element number %d:\n"), i); + grub_printf_ (N_("VDEV element number %d:\n"), i); print_vdev_info (child, tab + 1); =20 grub_free (child); --------------080006010109020308010202-- ------enig2BTLRBVLHUULVADDUPXOB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJRh8a+AAoJEEO073X3hHDOFbIH/01Y0mI1/UzMGUrpI7hH3AHB 8k4u23D3se9OHhIKTDL3Flg0E55lEevvqaQKsfy6nyrYQTM1uGa+gu3JKQU5igjn QQR5J/FlCPRRWKrdYCepXt8ZXFdHXx2TBQpT9g1Vw9C/f9c8opEQ1jHeXdjaAd+M XgQESxdIpbqX2OvtFyab29LvVMkapIwkcnNQLlKXeKxg/2zWZx/bSJmrgAz5VRx0 1WlJWsa2oWNREj9x85Q0jWvpbXWIWp/TzDWQGNvGbUlqEVyh7AgUN/dZf0/PG5OM ICEhDu1tIPNMfdzhZ4gebUiChhIm21rbxxd5u1KDtvJ6zusQkuCCi2wERsnOC+4= =P7cy -----END PGP SIGNATURE----- ------enig2BTLRBVLHUULVADDUPXOB--