qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: lampahome <pahome.chen@mirlab.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way?
Date: Thu, 2 Aug 2018 07:58:08 -0500	[thread overview]
Message-ID: <f94d3465-0dfb-a91a-04a8-efb65129f676@redhat.com> (raw)
In-Reply-To: <CAB3eZfuJ4g3nUdthx-sMkj9vCF6F=knu5YkGjcm8EdN-E-GQnA@mail.gmail.com>

On 08/02/2018 01:57 AM, lampahome wrote:

[Top-posting is difficult to read on technical lists; it's better to 
reply inline]

> I have some questions about qcow2
> If I have 2 img A & B, and A is backing file of B.
> Is the format(such as L1, L2, ref block...etc) different from A and B?

image A can be a completely different format from B (different cluster 
sizing, different refcount sizing, for that matter, image A doesn't even 
have to be qcow2).  All that matters from B's perspective is that a read 
of any cluster not present in B is satisfied by reading the same range 
of guest-visible bytes from image A in whatever manner A serves up those 
bytes; and a write to a cluster not present in B causes a COW 
(copy-on-write) operation to pull in remaining data from A for any 
portion of the cluster not covered by the write itself.  The entire 
block layer in qemu is a well-defined recursive interface of driver 
callbacks, where any particular operation calls through as few or as 
many block drivers as needed to either reach the data in question or 
determine that the data is not available.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

      reply	other threads:[~2018-08-02 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  9:44 [Qemu-devel] Any tutorial to read/write in qcow2 format by programming way? lampahome
2018-07-31 12:16 ` Eric Blake
2018-08-02  6:57   ` lampahome
2018-08-02 12:58     ` 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=f94d3465-0dfb-a91a-04a8-efb65129f676@redhat.com \
    --to=eblake@redhat.com \
    --cc=pahome.chen@mirlab.org \
    --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).