qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 6/9] qcow2: add bdrv_measure() support


From: Alberto Garcia
Subject: Re: [Qemu-devel] [PATCH v7 6/9] qcow2: add bdrv_measure() support
Date: Tue, 13 Jun 2017 17:07:13 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Tue 13 Jun 2017 03:33:26 PM CEST, Stefan Hajnoczi <address@hidden> wrote:
> Use qcow2_calc_prealloc_size() to get the required file size.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> Reviewed-by: Alberto Garcia <address@hidden>

You kept my R-b here but one of the changes was in this patch:

> +    info = g_new(BlockMeasureInfo, 1);
> +    info->fully_allocated =
> +        qcow2_calc_prealloc_size(virtual_size, cluster_size,
> +                                 ctz32(refcount_bits));
> +    if (DIV_ROUND_UP(info->fully_allocated, cluster_size) > INT_MAX) {
> +        g_free(info);
> +        error_setg(&local_err, "The image size is too large "
> +                               "(try using a larger cluster size)");
> +        goto err;
> +    }

This has the opposite problem than the previous version: valid image
sizes are now rejected by the 'measure' command.

$ qemu-img create -f qcow2 img.qcow2 1P
Formatting 'img.qcow2', fmt=qcow2 size=1125899906842624 encryption=off 
cluster_size=65536 lazy_refcounts=off refcount_bits=16

$ build/qemu-img measure -O qcow2 --size 1P
qemu-img: The image size is too large (try using a larger cluster size)

The actual limit is:

#define QCOW_MAX_L1_SIZE 0x2000000

That's 4194304 entries, each one can address cluster_size^2 / 8 bytes

So using that formula, here is the maximum virtual size depending on the
cluster size:

|--------------+------------------|
| Cluster size | Max virtual size |
|--------------+------------------|
| 512 bytes    | 128 GB           |
| 1 KB         | 512 GB           |
| 2 KB         | 2 TB             |
| 4 KB         | 8 TB             |
| 8 KB         | 32 TB            |
| 16 KB        | 128 TB           |
| 32 KB        | 512 TB           |
| 64 KB        | 2 PB             |
| 128 KB       | 8 PB             |
| 256 KB       | 32 PB            |
| 512 KB       | 128 PB           |
| 1 MB         | 512 PB           |
| 2 MB         | 2 EB             |
|--------------+------------------|

I just created a 2 EB image and it works fine, Linux can detect it
without problems, I can create a file system, etc.

If you specify a larger size, qcow2_grow_l1_table() fails with -EFIB.

Berto



reply via email to

[Prev in Thread] Current Thread [Next in Thread]