qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Brad Campbell <lists2009@fnarfbargle.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Qemu-img convert with -B
Date: Wed, 27 Apr 2011 11:05:48 +0800	[thread overview]
Message-ID: <4DB7880C.4090302@fnarfbargle.com> (raw)

G'day all,

I see there is a bug raised about the behaviour of qemu-img when used to 
convert using an output backing file. It allocates every sector whether 
or not it already exists in the output backing file.

I'm walking my way through the block driver to try and get a handle on 
why this is the case.

The comment in qemu-img.c is :

                 /* If the output image is being created as a copy on 
write image,
                    copy all sectors even the ones containing only NUL 
bytes,
                    because they may differ from the sectors in the base 
image.

Can someone verify these assumptions for me please?
- I can bdrv_open() a file that has a chain of backing files, and the 
following is true :
	- bdrv_read() returns the most recently allocated sector contents (or 0)
	- bdrv_is_allocated() will return false only if that sector is not 
allocated in _any_ of the files in the chain

If these assumptions are true, can anyone see a logical error in 
bdrv_open() both the input file and the out_baseimg, and where sectors 
are allocated comparing them to see if the are the same. If so, not 
allocating those in the output file?

I'm assuming the comment above is to allow for the case that someone 
specifies the output backing file being different from the last input 
backing file.

Am I missing something?

Regards,
Brad

             reply	other threads:[~2011-04-27  3:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  3:05 Brad Campbell [this message]
2011-04-27  8:10 ` [Qemu-devel] Qemu-img convert with -B Stefan Hajnoczi
2011-04-27  8:56   ` Brad Campbell
2011-04-27 10:06     ` Kevin Wolf
2011-04-27 13:45       ` Brad Campbell
2011-04-27 13:56         ` Kevin Wolf
2011-04-27 14:02           ` Brad Campbell
2011-04-28  2:06             ` Brad Campbell
2011-04-28  6:36               ` Kevin Wolf
2011-04-28  9:38                 ` Brad Campbell

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=4DB7880C.4090302@fnarfbargle.com \
    --to=lists2009@fnarfbargle.com \
    --cc=qemu-devel@nongnu.org \
    /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).