qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] qemu-img: Allow cache mode specification for amend
Date: Mon, 21 Jul 2014 09:57:35 -0600	[thread overview]
Message-ID: <53CD386F.307@redhat.com> (raw)
In-Reply-To: <1405802159-2355-3-git-send-email-mreitz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

On 07/19/2014 02:35 PM, Max Reitz wrote:
> qemu-img amend may extensively modify the target image, depending on the
> 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.

> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  qemu-img-cmds.hx |  4 ++--
>  qemu-img.c       | 19 +++++++++++++++----
>  qemu-img.texi    |  2 +-
>  3 files changed, 18 insertions(+), 7 deletions(-)
> 

>  
> +    cache = BDRV_DEFAULT_CACHE;
>      for (;;) {
> -        c = getopt(argc, argv, "hqf:o:");
> +        c = getopt(argc, argv, "hqf:t:o:");
>          if (c == -1) {
>              break;
>          }
> @@ -2805,6 +2807,9 @@ static int img_amend(int argc, char **argv)
>              case 'f':
>                  fmt = optarg;
>                  break;
> +            case 't':
> +                cache = 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 <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-07-21 15:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-19 20:35 [Qemu-devel] [PATCH 0/2] qemu-img: Allow source cache mode specification Max Reitz
2014-07-19 20:35 ` [Qemu-devel] [PATCH 1/2] " Max Reitz
2014-07-21 15:52   ` Eric Blake
2014-07-22 20:06     ` Max Reitz
2014-07-23  8:10       ` Kevin Wolf
2014-07-24 23:44         ` Max Reitz
2014-07-19 20:35 ` [Qemu-devel] [PATCH 2/2] qemu-img: Allow cache mode specification for amend Max Reitz
2014-07-21 15:57   ` Eric Blake [this message]
2014-07-22 20:09     ` Max Reitz

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=53CD386F.307@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).