From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 for-1.2 1/2] stream: complete early if end of backing file is reached
Date: Tue, 28 Aug 2012 16:37:32 +0200 [thread overview]
Message-ID: <503CD7AC.3020109@redhat.com> (raw)
In-Reply-To: <1346164009-30648-2-git-send-email-stefanha@linux.vnet.ibm.com>
Il 28/08/2012 16:26, Stefan Hajnoczi ha scritto:
> It is possible to create an image that is larger than its backing file.
> Reading beyond the end of the backing file produces zeroes if no writes
> have been made to those sectors in the image file.
>
> This patch finishes streaming early when the end of the backing file is
> reached. Without this patch the block job hangs and continually tries
> to stream the first sectors beyond the end of the backing file.
>
> To reproduce the hung block job bug:
>
> $ qemu-img create -f qcow2 backing.qcow2 128M
> $ qemu-img create -f qcow2 -o backing_file=backing.qcow2 image.qcow2 6G
> $ qemu -drive if=virtio,cache=none,file=image.qcow2
> (qemu) block_stream virtio0
> (qemu) info block-jobs
>
> The qemu-iotests 030 streaming test still passes.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> block/stream.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/block/stream.c b/block/stream.c
> index 37c4652..c4f87dd 100644
> --- a/block/stream.c
> +++ b/block/stream.c
> @@ -122,6 +122,12 @@ wait:
> * known-unallocated area [sector_num, sector_num+n). */
> ret = bdrv_co_is_allocated_above(bs->backing_hd, base,
> sector_num, n, &n);
> +
> + /* Finish early if end of backing file has been reached */
> + if (ret == 0 && n == 0) {
> + n = end - sector_num;
> + }
Reviewed-by: Paolo Bonzini <pbonzini@gnu.org>
> copy = (ret == 1);
> }
> trace_stream_one_iteration(s, sector_num, n, ret);
>
next prev parent reply other threads:[~2012-08-28 14:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-28 14:26 [Qemu-devel] [PATCH v2 for-1.2 0/2] stream: complete early if end of backing file is reached Stefan Hajnoczi
2012-08-28 14:26 ` [Qemu-devel] [PATCH v2 for-1.2 1/2] " Stefan Hajnoczi
2012-08-28 14:37 ` Paolo Bonzini [this message]
2012-08-28 14:26 ` [Qemu-devel] [PATCH v2 for-1.2 2/2] qemu-iotests: add backing file smaller than image test case Stefan Hajnoczi
2012-08-28 14:38 ` Paolo Bonzini
2012-08-28 19:08 ` [Qemu-devel] [PATCH v2 for-1.2 0/2] stream: complete early if end of backing file is reached Kevin Wolf
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=503CD7AC.3020109@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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).