qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dushyant Bansal <cs5070214@cse.iitd.ac.in>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: KVM call agenda for Jan 25
Date: Sun, 27 Mar 2011 03:26:59 +0530	[thread overview]
Message-ID: <4D8E612B.4030107@cse.iitd.ac.in> (raw)
In-Reply-To: <4D81DD6C.4000203@redhat.com>


>> On the other hand, I think the starting point for a generic in-place
>> converter would be a loop that does something like bdrv_is_allocated()
>> but translates the guest position in the block device into an offset
>> into the image file.  That, together with some sort of free map or
>> space allocation bitmap would allow a generic approach to figuring out
>> the data mapping and which parts of the file can be safely used.
>>      
> We can discuss the detailed API later, but I agree that the critical
> thing to convert is the mapping.
>
> You would probably open the file with the source format driver read-only
> and with the destination driver read-write. For qcow2 you would start
> with writing a refcount table that marks the whole file as used, other
> formats use the file size anyway. Then you can start creating L1 and L2
> tables and copy the mapping over. Once this is done, you do an fsck to
> free the metadata of the old format.
>
> One thing that may become tricky is the image header which both drivers
> may want to use and which is fixed at offset 0. And of course, you must
> make sure that the image is safe at any point if the converter crashes.
>    
For image header issue, this is the approach that comes to mind.
Lets say, destination format is qcow2.
BDRVQcowState is responsible for header fields inside BlockDriverState. 
We need qcow2 image header to initiliaze all the fields of 
BDRVQcowState, which is done by bdrv_open(qcow2_open()).

So initially, for the qcow2 driver, we do not copy the qcow2 image 
header (we keep the source header). We can then manually set fields of 
BDRVQcowState with the desired header fields.
And after all other metadata has been copied for the qcow2 format, we 
can replace the source image header with the qcow2 header.


Thanks,
Dushyant

  reply	other threads:[~2011-03-26 21:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 13:25 [Qemu-devel] KVM call agenda for Jan 25 Chris Wright
2011-01-24 22:06 ` [Qemu-devel] " Anthony Liguori
2011-01-25 13:57   ` Luiz Capitulino
2011-01-25 14:02     ` Luiz Capitulino
2011-01-25 14:13       ` Stefan Hajnoczi
2011-01-29 10:50         ` Dushyant Bansal
2011-01-29 13:16           ` Stefan Hajnoczi
2011-02-25 17:42           ` Dushyant Bansal
2011-02-26 14:05             ` Stefan Hajnoczi
2011-02-26 21:50               ` Dushyant Bansal
2011-02-27 10:49                 ` Stefan Hajnoczi
2011-02-28  7:36                   ` Markus Armbruster
2011-02-28 20:41                   ` Dushyant Bansal
2011-03-01  9:40                     ` Stefan Hajnoczi
2011-03-14 15:13                       ` Dushyant Bansal
2011-03-15 10:27                         ` Kevin Wolf
2011-03-16 14:17                           ` Dushyant Bansal
2011-03-16 17:47                           ` Stefan Hajnoczi
2011-03-17 10:07                             ` Kevin Wolf
2011-03-26 21:56                               ` Dushyant Bansal [this message]
2011-03-28 10:26                                 ` Kevin Wolf
2011-01-25 14:11     ` Aurelien Jarno
2011-01-25 14:27       ` Anthony Liguori
2011-01-25 14:42       ` Kevin Wolf
2011-01-25 15:29         ` Aurelien Jarno
2011-01-25 14:26   ` Avi Kivity
2011-01-25 14:35     ` Stefan Hajnoczi
2011-01-26  9:58       ` Avi Kivity

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=4D8E612B.4030107@cse.iitd.ac.in \
    --to=cs5070214@cse.iitd.ac.in \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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).