All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Mike Day <ncmike@ncultra.org>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qemu-img fails to delete last snapshot
Date: Mon, 12 May 2014 10:39:27 -0600	[thread overview]
Message-ID: <5370F93F.3040001@redhat.com> (raw)
In-Reply-To: <1399647772-4402-1-git-send-email-ncmike@ncultra.org>

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

On 05/09/2014 09:02 AM, Mike Day wrote:
> When deleting the last snapshot, copying the resulting snapshot table
> currently fails, causing the delete operation to also fail. Fix the
> failure by skipping the copy and just writing the snapshot header and
> freeing the extra clusters.
> 
> Signed-off-by: Mike Day <ncmike@ncultra.org>
> ---
> 
> There are two specific problems in the curent code. First is a lack of

s/curent/current/

> parenthesis in the calculation of a memmove parameter:
> 
> s->nb_snapshots - snapshot_index - 1
> 
> When s->nb_snapshots is 0, snapshot_index is 1. 
> 
> 0 - 1 - 1 = 0xfffffffe
> 
> it should be:
> 
> 0 - (1 - 1) = 0x00
> 
> The second problem is shifting the snapshot table to the left. After
> removing the last snapshot there are no existing snapshots to be
> shifted. All that needs to be done is to write the header and
> unallocate the blocks.

This information is actually quite useful in understanding the patch,
and I would have included it prior to the --- for inclusion in git,
rather than in the reviewer-only commentary that gets stripped during
'git am'.

> 
>  block/qcow2-snapshot.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)

I'd suggest posting a v2 with a better commit message; but the code
itself seems fine, so you can add:

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-05-12 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 15:02 [Qemu-devel] [PATCH] qemu-img fails to delete last snapshot Mike Day
2014-05-12 16:39 ` Eric Blake [this message]
2014-05-12 18:31   ` Mike Day

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=5370F93F.3040001@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=ncmike@ncultra.org \
    --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 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.