qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org,
	stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] block: Use bdrv functions to replace file operation in qcow.c
Date: Fri, 18 Nov 2011 10:59:05 +0000	[thread overview]
Message-ID: <CAJSP0QXfetSM8zewDtrYkL9F2790UXtcS1Bh761nL5UQxE8twQ@mail.gmail.com> (raw)
In-Reply-To: <1321607573-29744-1-git-send-email-zhihuili@linux.vnet.ibm.com>

On Fri, Nov 18, 2011 at 9:12 AM, Li Zhi Hui <zhihuili@linux.vnet.ibm.com> wrote:
> +    tmp = g_malloc0(sizeof(uint64_t)*l1_size);
> +    ret = bdrv_pwrite(qcow_bs, header_size, tmp, sizeof(uint64_t)*l1_size);
> +    g_free(tmp);
> +    if (ret != sizeof(uint64_t)*l1_size) {
> +        goto exit;
>     }

qemu-img create -f qcow test.qcow 100T

>>> 100 * 1024 * 1024 * 1024 * 1024 / ((1 << 12) * (1 << 9))
52428800
>>> 52428800 * 8
419430400

That means 400 MB of RAM for the zero L1 table for a 100 TB image.
Since qcow is a legacy format this probably doesn't matter in practice
but in theory this approach can require a noticable amount of RAM.

Looks okay to me.

Stefan

  reply	other threads:[~2011-11-18 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18  9:12 [Qemu-devel] [PATCH] block: Use bdrv functions to replace file operation in qcow.c Li Zhi Hui
2011-11-18 10:59 ` Stefan Hajnoczi [this message]
2011-11-18 11:10   ` Paolo Bonzini
2011-11-18 14:34     ` Stefan Hajnoczi
2011-11-21 10:44       ` Kevin Wolf
2011-11-21 10:53         ` Stefan Hajnoczi
2011-11-21 11:08           ` Kevin Wolf
2011-11-21 12:48             ` Paolo Bonzini

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=CAJSP0QXfetSM8zewDtrYkL9F2790UXtcS1Bh761nL5UQxE8twQ@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=zhihuili@linux.vnet.ibm.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).