From: Pekka Enberg <penberg@kernel.org>
To: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: kvm@vger.kernel.org, Asias He <asias.hejun@gmail.com>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Sasha Levin <levinsasha928@gmail.com>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] kvm tools: Add read-only support for QCOW2 images
Date: Wed, 20 Apr 2011 18:57:23 +0300 (EEST) [thread overview]
Message-ID: <alpine.DEB.2.00.1104201855420.5088@tiger> (raw)
In-Reply-To: <BANLkTi=Oi1MigCncsejnFSF7uZ=Y4CebCw@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3796 bytes --]
On Tue, 19 Apr 2011, Prasad Joshi wrote:
> On Tue, Apr 19, 2011 at 10:07 PM, Pekka Enberg <penberg@kernel.org> wrote:
> This patch extends the QCOW1 format to also support QCOW2 images as specified
> by the following document:
>
> http://people.gnome.org/~markmc/qcow-image-format.html
>
> Cc: Asias He <asias.hejun@gmail.com>
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Prasad Joshi <prasadjoshi124@gmail.com>
> Cc: Sasha Levin <levinsasha928@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>
> ---
> tools/kvm/include/kvm/qcow.h | 42 ++++++++++-
> tools/kvm/qcow.c | 177 +++++++++++++++++++++++++++++++++---------
> 2 files changed, 181 insertions(+), 38 deletions(-)
>
> diff --git a/tools/kvm/include/kvm/qcow.h b/tools/kvm/include/kvm/qcow.h
> index 4be2597..afd776d 100644
> --- a/tools/kvm/include/kvm/qcow.h
> +++ b/tools/kvm/include/kvm/qcow.h
> @@ -4,9 +4,17 @@
> #include <linux/types.h>
>
> #define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb)
> +
> #define QCOW1_VERSION 1
> +#define QCOW2_VERSION 2
> +
> +#define QCOW1_OFLAG_COMPRESSED (1LL << 63)
> +
> +#define QCOW1_OFLAG_MASK QCOW1_OFLAG_COMPRESSED
>
> -#define QCOW_OFLAG_COMPRESSED (1LL << 63)
> +#define QCOW2_OFLAG_COPIED (1LL << 63)
> +#define QCOW2_OFLAG_COMPRESSED (1LL << 62)
> +#define QCOW2_OFLAG_MASK (QCOW2_OFLAG_COPIED|QCOW2_OFLAG_COMPRESSED)
>
> struct qcow_table {
> u32 table_size;
> @@ -19,7 +27,16 @@ struct qcow {
> int fd;
> };
>
> -struct qcow1_header {
> +struct qcow_header {
> + u64 size; /* in bytes */
> + u64 l1_table_offset;
> + u32 l1_size;
> + u8 cluster_bits;
> + u8 l2_bits;
> + uint64_t oflag_mask;
> +};
> +
> +struct qcow1_header_disk {
> u32 magic;
> u32 version;
>
> @@ -36,6 +53,27 @@ struct qcow1_header {
> u64 l1_table_offset;
> };
>
> +struct qcow2_header_disk {
> + u32 magic;
> + u32 version;
> +
> + u64 backing_file_offset;
> + u32 backing_file_size;
> +
> + u32 cluster_bits;
> + u64 size; /* in bytes */
> + u32 crypt_method;
> +
> + u32 l1_size;
> + u64 l1_table_offset;
> +
> + u64 refcount_table_offset;
> + u32 refcount_table_clusters;
> +
> + u32 nb_snapshots;
> + u64 snapshots_offset;
> +};
>
> IMHO, as we start adding other features of QCOW, the two structures qcow2_header_disk and qcow_header might eventually become the same.
No, the point of 'struct qcow2_header_disk' is to map to the on-disk
representation. 'struct qcow_header' is the in-memory version of the data.
> + disk_image = disk_image__new(fd, h->size, &qcow1_disk_ops);
>
>
> qcow1_disk_ops can be changed to qcow_disk_ops.
Sure, there's more qcow1 prefixes that need fixing now as well.
prev parent reply other threads:[~2011-04-20 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 21:07 [PATCH] kvm tools: Add read-only support for QCOW2 images Pekka Enberg
[not found] ` <BANLkTi=Oi1MigCncsejnFSF7uZ=Y4CebCw@mail.gmail.com>
2011-04-20 15:57 ` Pekka Enberg [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=alpine.DEB.2.00.1104201855420.5088@tiger \
--to=penberg@kernel.org \
--cc=asias.hejun@gmail.com \
--cc=gorcunov@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=prasadjoshi124@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