qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Jeff Cody <jcody@redhat.com>
Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] block: resize backing file image during offline commit, if necessary
Date: Fri, 17 Jan 2014 15:23:00 +0800	[thread overview]
Message-ID: <20140117072300.GC19441@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <677e470b5c2823a06afd63ba72f17f083d944fa3.1389644007.git.jcody@redhat.com>

On Mon, Jan 13, 2014 at 03:18:45PM -0500, Jeff Cody wrote:
> @@ -1904,7 +1904,19 @@ int bdrv_commit(BlockDriverState *bs)
>          }
>      }
>  
> -    total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
> +    length = bdrv_getlength(bs);
> +
> +    /* If our top snapshot is larger than the backing file image,
> +     * grow the backing file image if possible.  If not possible,
> +     * we must return an error */
> +    if (length > bdrv_getlength(bs->backing_hd)) {
> +        ret = bdrv_truncate(bs->backing_hd, length);

bdrv_getlength() is allowed to return -errno.  It's unlikely here but we
should at least check bdrv_getlength(bs), probably also
bdrv_getlength(bs->backing_hd).

  reply	other threads:[~2014-01-17  7:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 20:18 [Qemu-devel] [PATCH 0/2] block: commits of snapshots larger than backing files Jeff Cody
2014-01-13 20:18 ` [Qemu-devel] [PATCH 1/2] block: resize backing file image during offline commit, if necessary Jeff Cody
2014-01-17  7:23   ` Stefan Hajnoczi [this message]
2014-01-13 20:18 ` [Qemu-devel] [PATCH 2/2] block: resize backing image during active layer commit, if needed Jeff Cody
2014-01-15  5:58   ` Fam Zheng
2014-01-17 16:29     ` Jeff Cody
2014-01-17  7:17 ` [Qemu-devel] [PATCH 0/2] block: commits of snapshots larger than backing files Stefan Hajnoczi
2014-01-17 16:10   ` Jeff Cody

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=20140117072300.GC19441@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --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).