From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9FyJ-0004D9-LW for qemu-devel@nongnu.org; Mon, 21 Jul 2014 11:57:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9FyD-0004l1-OO for qemu-devel@nongnu.org; Mon, 21 Jul 2014 11:57:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9FyD-0004ks-Gy for qemu-devel@nongnu.org; Mon, 21 Jul 2014 11:57:45 -0400 Message-ID: <53CD386F.307@redhat.com> Date: Mon, 21 Jul 2014 09:57:35 -0600 From: Eric Blake MIME-Version: 1.0 References: <1405802159-2355-1-git-send-email-mreitz@redhat.com> <1405802159-2355-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1405802159-2355-3-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Qw8nfWq1XU4VGbRObXkBGkRgsvSGgUtom" Subject: Re: [Qemu-devel] [PATCH 2/2] qemu-img: Allow cache mode specification for amend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Qw8nfWq1XU4VGbRObXkBGkRgsvSGgUtom Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/19/2014 02:35 PM, Max Reitz wrote: > qemu-img amend may extensively modify the target image, depending on th= e > options to be amended (e.g. conversion to qcow2 compat level 0.10 from > 1.1 for an image with many unallocated zero clusters). Therefore it > makes sense to allow the user to specify the cache mode to be used. Extensive modifications implies long-running operation - the 'amend' subcommand is a good candidate for the -p progress meter option. But that would be a separate patch. >=20 > Signed-off-by: Max Reitz > --- > qemu-img-cmds.hx | 4 ++-- > qemu-img.c | 19 +++++++++++++++---- > qemu-img.texi | 2 +- > 3 files changed, 18 insertions(+), 7 deletions(-) >=20 > =20 > + cache =3D BDRV_DEFAULT_CACHE; > for (;;) { > - c =3D getopt(argc, argv, "hqf:o:"); > + c =3D getopt(argc, argv, "hqf:t:o:"); > if (c =3D=3D -1) { > break; > } > @@ -2805,6 +2807,9 @@ static int img_amend(int argc, char **argv) > case 'f': > fmt =3D optarg; > break; > + case 't': > + cache =3D optarg; > + break; > case 'q': Pre-existing, so I won't hold up review, but I'm a big fan of having the switch block in the same order as the getopt string (that is, we listed 'q' before 'f' in the string above, so the cases are out-of-order with respect to that string). The fix can go either way (reshuffle the case statements, or reorder the optstring above). [and for the truly OCD, I prefer the optstring in case-insensitive alphabetical order "f:ho:qt:", because then it's easier to scan the string to see what letters are still available for new options - but that's asking a bit much] Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Qw8nfWq1XU4VGbRObXkBGkRgsvSGgUtom Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTzThvAAoJEKeha0olJ0NqRiQH/A/IS+y0xtwfy+0RnXE/DpcH 6gX3QWESFUtLzlVeZSxzFkCjYiUgOqFBH8KpLzErFSifFWtZYmGfUlelU982D0cm UrThZS2uq1DCIzPC6NM5VeMY0RJT1Viq1tKQe+jIzOazRo/zrdXIlDfeL0DU0GWv 1KYw34gojjNnZekT9OgoYrUr1brgO8f+ixcN4oLshwlH/6bhHzyS/FCBfPzfJz2p 9oIpuPxIZPey3/3VUugYJNqfFeuz9F+3QaojJMlXCUYexEkMDHf0ZEc/2AZgl8nJ BIPkdPQwDPYs1yvfbrhcZox7NFlP4hIzKNC4zbbD1xJrNllamzXsTNy65nOAR8w= =YDjb -----END PGP SIGNATURE----- --Qw8nfWq1XU4VGbRObXkBGkRgsvSGgUtom--