On Fri, Nov 18, 2011 at 9:12 AM, Li Zhi Hui <zhihu...@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 via email to