From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qcow2: Flush image after creation
Date: Thu, 24 Oct 2013 11:04:43 +0100 [thread overview]
Message-ID: <5268F0BB.1010604@redhat.com> (raw)
In-Reply-To: <1382557241-23117-1-git-send-email-mreitz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]
On 10/23/2013 08:40 PM, Max Reitz wrote:
> Opening the qcow2 image with BDRV_O_NO_FLUSH prevents any flushes during
> the image creation. This means that the image has not yet been flushed
> to disk when qemu-img create exits. This flush is delayed until the next
> operation on the image involving opening it without BDRV_O_NO_FLUSH and
> closing (or directly flushing) it. For large images and/or images with a
> small cluster size and preallocated metadata, this flush may take a
> significant amount of time and may occur unexpectedly.
>
> Reopening the image without BDRV_O_NO_FLUSH right before the end of
> qcow2_create2() results in preponing the potentially costly flush into
s/preponing/hoisting/
> the image creation, which is expected to take some time (whereas
> successive image operations may be not).
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block/qcow2.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
> - ret = 0;
> + bdrv_close(bs);
> +
> + /* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning */
> + ret = bdrv_open(bs, filename, NULL,
> + BDRV_O_RDWR | BDRV_O_CACHE_WB, drv, &local_err);
I would probably have indented as:
ret = bdrv_open(bs, filename, NULL,
BDRV_O_RDWR | BDRV_O_CACHE_WB,
drv, &local_err);
but it's trivial enough that I'm also fine with your choice.
--
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: 621 bytes --]
prev parent reply other threads:[~2013-10-24 10:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 19:40 [Qemu-devel] [PATCH] qcow2: Flush image after creation Max Reitz
2013-10-24 10:00 ` Kevin Wolf
2013-10-24 10:04 ` Eric Blake [this message]
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=5268F0BB.1010604@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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 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.