From: Eric Blake <eblake@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Anton Nefedov <anton.nefedov@virtuozzo.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
"Denis V . Lunev" <den@openvz.org>
Subject: Re: [RFC PATCH v3 05/27] qcow2: Document the Extended L2 Entries feature
Date: Thu, 20 Feb 2020 08:28:17 -0600 [thread overview]
Message-ID: <3a946970-5a26-6c40-a212-0aefdccef509@redhat.com> (raw)
In-Reply-To: <0b884ddcd0ac3a3c0b8cdd9d09c74566ac107c9a.1577014346.git.berto@igalia.com>
On 12/22/19 5:36 AM, Alberto Garcia wrote:
> Subcluster allocation in qcow2 is implemented by extending the
> existing L2 table entries and adding additional information to
> indicate the allocation status of each subcluster.
>
> This patch documents the changes to the qcow2 format and how they
> affect the calculation of the L2 cache size.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> docs/interop/qcow2.txt | 68 ++++++++++++++++++++++++++++++++++++++++--
> docs/qcow2-cache.txt | 19 +++++++++++-
> 2 files changed, 83 insertions(+), 4 deletions(-)
This adds a new feature bit; where is the corresponding patch to qcow2.c
to advertise the feature bit name in the optional feature name table?
/me reads ahead
good, patch 25 covers it. Quick comment added there as a result.
> +== Extended L2 Entries ==
> +
> +An image uses Extended L2 Entries if bit 3 is set on the incompatible_features
> +field of the header.
> +
> +In these images standard data clusters are divided into 32 subclusters of the
> +same size. They are contiguous and start from the beginning of the cluster.
> +Subclusters can be allocated independently and the L2 entry contains information
> +indicating the status of each one of them. Compressed data clusters don't have
> +subclusters so they are treated like in images without this feature.
Grammar; I'd suggest:
...don't have subclusters, so they are treated the same as in images
without this feature.
Are they truly the same, or do you still need to document that the extra
64 bits of the extended L2 entry are all zero?
> +
> +The size of an extended L2 entry is 128 bits so the number of entries per table
> +is calculated using this formula:
> +
> + l2_entries = (cluster_size / (2 * sizeof(uint64_t)))
> +
> +The first 64 bits have the same format as the standard L2 table entry described
> +in the previous section, with the exception of bit 0 of the standard cluster
> +descriptor.
> +
> +The last 64 bits contain a subcluster allocation bitmap with this format:
> +
> +Subcluster Allocation Bitmap (for standard clusters):
> +
> + Bit 0 - 31: Allocation status (one bit per subcluster)
> +
> + 1: the subcluster is allocated. In this case the
> + host cluster offset field must contain a valid
> + offset.
> + 0: the subcluster is not allocated. In this case
> + read requests shall go to the backing file or
> + return zeros if there is no backing file data.
> +
> + Bits are assigned starting from the most significant one.
> + (i.e. bit x is used for subcluster 31 - x)
> +
Missing trailing '.'
> + 32 - 63 Subcluster reads as zeros (one bit per subcluster)
> +
> + 1: the subcluster reads as zeros. In this case the
> + allocation status bit must be unset. The host
> + cluster offset field may or may not be set.
Why must the allocation bit be unset? When we preallocate, we want a
cluster to reserve space, but still read as zero, so the combination of
both bits set makes sense to me.
> + 0: no effect.
> +
> + Bits are assigned starting from the most significant one.
> + (i.e. bit x is used for subcluster 63 - x)
and again.
> +
> +Subcluster Allocation Bitmap (for compressed clusters):
> +
> + Bit 0 - 63: Reserved (set to 0)
> + Compressed clusters don't have subclusters,
> + so this field is not used.
>
> == Snapshots ==
>
> diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
> index d57f409861..04eb4ce2f1 100644
> --- a/docs/qcow2-cache.txt
> +++ b/docs/qcow2-cache.txt
> @@ -1,6 +1,6 @@
> qcow2 L2/refcount cache configuration
> =====================================
> -Copyright (C) 2015, 2018 Igalia, S.L.
> +Copyright (C) 2015, 2018-2019 Igalia, S.L.
Our review is late; you could add 2020 if desired, now.
> Author: Alberto Garcia <berto@igalia.com>
>
> This work is licensed under the terms of the GNU GPL, version 2 or
> @@ -222,3 +222,20 @@ support this functionality, and is 0 (disabled) on other platforms.
> This functionality currently relies on the MADV_DONTNEED argument for
> madvise() to actually free the memory. This is a Linux-specific feature,
> so cache-clean-interval is not supported on other systems.
> +
> +
> +Extended L2 Entries
> +-------------------
> +All numbers shown in this document are valid for qcow2 images with normal
> +64-bit L2 entries.
> +
> +Images with extended L2 entries need twice as much L2 metadata, so the L2
> +cache size must be twice as large for the same disk space.
> +
> + disk_size = l2_cache_size * cluster_size / 16
> +
> +i.e.
> +
> + l2_cache_size = disk_size * 16 / cluster_size
> +
> +Refcount blocks are not affected by this.
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-02-20 14:29 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-22 11:36 [RFC PATCH v3 00/27] Add subcluster allocation to qcow2 Alberto Garcia
2019-12-22 11:36 ` [RFC PATCH v3 01/27] qcow2: Add calculate_l2_meta() Alberto Garcia
2020-02-20 13:28 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 02/27] qcow2: Split cluster_needs_cow() out of count_cow_clusters() Alberto Garcia
2020-02-20 13:32 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 03/27] qcow2: Process QCOW2_CLUSTER_ZERO_ALLOC clusters in handle_copied() Alberto Garcia
2020-02-20 14:53 ` Eric Blake
2020-02-20 15:00 ` Max Reitz
2020-02-20 15:19 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 04/27] qcow2: Add get_l2_entry() and set_l2_entry() Alberto Garcia
2020-02-20 15:22 ` Eric Blake
2020-02-20 16:08 ` Alberto Garcia
2020-02-20 15:39 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 05/27] qcow2: Document the Extended L2 Entries feature Alberto Garcia
2020-02-20 14:28 ` Eric Blake [this message]
2020-02-20 14:49 ` Alberto Garcia
2020-02-20 15:16 ` Eric Blake
2020-02-26 16:57 ` Alberto Garcia
2020-02-20 14:33 ` Eric Blake
2020-02-20 16:10 ` Alberto Garcia
2020-02-20 15:54 ` Max Reitz
2020-02-20 16:02 ` Eric Blake
2020-02-20 16:04 ` Alberto Garcia
2019-12-22 11:36 ` [RFC PATCH v3 06/27] qcow2: Add dummy has_subclusters() function Alberto Garcia
2020-02-20 15:24 ` Eric Blake
2020-02-20 16:03 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 07/27] qcow2: Add subcluster-related fields to BDRVQcow2State Alberto Garcia
2020-02-20 15:28 ` Eric Blake
2020-02-20 16:34 ` Alberto Garcia
2020-02-20 16:48 ` Eric Blake
2020-02-21 13:14 ` Alberto Garcia
2020-02-20 16:15 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 08/27] qcow2: Add offset_to_sc_index() Alberto Garcia
2020-02-20 16:19 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 09/27] qcow2: Add l2_entry_size() Alberto Garcia
2020-02-20 16:24 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 10/27] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap() Alberto Garcia
2020-02-20 16:27 ` Max Reitz
2020-02-21 13:57 ` Alberto Garcia
2019-12-22 11:36 ` [RFC PATCH v3 11/27] qcow2: Add QCow2SubclusterType and qcow2_get_subcluster_type() Alberto Garcia
2020-02-20 17:21 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 12/27] qcow2: Replace QCOW2_CLUSTER_* with QCOW2_SUBCLUSTER_* Alberto Garcia
2020-02-21 11:35 ` Max Reitz
2020-02-21 15:14 ` Alberto Garcia
2019-12-22 11:36 ` [RFC PATCH v3 13/27] qcow2: Handle QCOW2_SUBCLUSTER_UNALLOCATED_ALLOC Alberto Garcia
2020-02-21 12:02 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 14/27] qcow2: Add subcluster support to calculate_l2_meta() Alberto Garcia
2020-02-21 13:34 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 15/27] qcow2: Add subcluster support to qcow2_get_cluster_offset() Alberto Garcia
2020-02-21 14:21 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 16/27] qcow2: Add subcluster support to zero_in_l2_slice() Alberto Garcia
2020-02-21 14:37 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 17/27] qcow2: Add subcluster support to discard_in_l2_slice() Alberto Garcia
2020-02-21 14:45 ` Max Reitz
2019-12-22 11:36 ` [RFC PATCH v3 18/27] qcow2: Add subcluster support to check_refcounts_l2() Alberto Garcia
2020-02-21 14:47 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 19/27] qcow2: Add subcluster support to expand_zero_clusters_in_l1() Alberto Garcia
2020-02-21 14:57 ` Max Reitz
2020-02-26 17:19 ` Alberto Garcia
2020-02-27 9:17 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 20/27] qcow2: Fix offset calculation in handle_dependencies() Alberto Garcia
2020-02-21 15:01 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 21/27] qcow2: Update L2 bitmap in qcow2_alloc_cluster_link_l2() Alberto Garcia
2020-02-21 15:43 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 22/27] qcow2: Clear the L2 bitmap when allocating a compressed cluster Alberto Garcia
2020-02-21 15:46 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 23/27] qcow2: Add subcluster support to handle_alloc_space() Alberto Garcia
2020-02-21 15:56 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 24/27] qcow2: Restrict qcow2_co_pwrite_zeroes() to full clusters only Alberto Garcia
2020-02-21 16:02 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 25/27] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit Alberto Garcia
2020-02-20 14:12 ` Eric Blake
2020-02-20 14:16 ` Alberto Garcia
2020-02-21 16:44 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 26/27] qcow2: Add subcluster support to qcow2_measure() Alberto Garcia
2020-02-21 16:52 ` Max Reitz
2019-12-22 11:37 ` [RFC PATCH v3 27/27] iotests: Add tests for qcow2 images with extended L2 entries Alberto Garcia
2020-02-21 17:04 ` Max Reitz
2020-02-21 17:10 ` [RFC PATCH v3 00/27] Add subcluster allocation to qcow2 Max Reitz
2020-02-22 17:59 ` Alberto Garcia
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=3a946970-5a26-6c40-a212-0aefdccef509@redhat.com \
--to=eblake@redhat.com \
--cc=anton.nefedov@virtuozzo.com \
--cc=berto@igalia.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).