[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V4 12/30] qcow2: Load and save deduplication table
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC V4 12/30] qcow2: Load and save deduplication table header extension. |
Date: |
Fri, 04 Jan 2013 17:02:13 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
On 01/02/2013 09:16 AM, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <address@hidden>
> ---
> block/qcow2.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 410d3c1..9a7177b 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -53,9 +53,16 @@ typedef struct {
> uint32_t len;
> } QCowExtension;
>
> +typedef struct {
> + uint64_t offset;
> + int32_t size;
> + uint8_t hash_algo;
> +} QCowDedupTableExtension;
This struct has a hole at the end (that is, you only specify 13 bytes,
but sizeof(QCowDedupTableExtension) is 16)...
> + if (s->has_dedup) {
> + dedup_table_extension.offset = cpu_to_be64(s->dedup_table_offset);
> + dedup_table_extension.size = cpu_to_be32(s->dedup_table_size);
> + dedup_table_extension.hash_algo = s->dedup_hash_algo;
> + ret = header_ext_add(buf,
> + QCOW2_EXT_MAGIC_DEDUP_TABLE,
> + &dedup_table_extension,
> + sizeof(dedup_table_extension),
> + buflen);
...but here you are writing out that hole. It would be better if you
explicitly accounted for all bytes being written, so that the reserved
fields are guaranteed to be 0 instead of random data, so that future
extensions can make use of those reserved bytes.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC V4 24/30] qcow2: Do not overwrite existing entries with QCOW_OFLAG_COPIED., (continued)
- [Qemu-devel] [RFC V4 24/30] qcow2: Do not overwrite existing entries with QCOW_OFLAG_COPIED., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 30/30] qemu-iotests: Filter dedup=on/off so existing tests don't break., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 29/30] qcow2: init and cleanup deduplication., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 20/30] qcow2: Serialize write requests when deduplication is activated., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 22/30] qcow2: Adapt checking of QCOW_OFLAG_COPIED for dedup., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 28/30] qcow: Set dedup cluster block size to 64KB., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 27/30] qcow2: Use large L2 table for deduplication., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 12/30] qcow2: Load and save deduplication table header extension., Benoît Canet, 2013/01/02
- Re: [Qemu-devel] [RFC V4 12/30] qcow2: Load and save deduplication table header extension.,
Eric Blake <=
- [Qemu-devel] [RFC V4 16/30] qcow2: Extract qcow2_add_feature and qcow2_remove_feature., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 06/30] qcow2: Add qcow2_dedup and related functions, Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 26/30] qcow2: Add lazy refcounts to deduplication to prevent qcow2_cache_set_dependency loops, Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 18/30] qcow2: Behave correctly when refcount reach 0 or 2^16., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 11/30] qcow2: create function to load deduplication hashes at startup., Benoît Canet, 2013/01/02
- [Qemu-devel] [RFC V4 13/30] qcow2: Extract qcow2_do_table_init., Benoît Canet, 2013/01/02
- Re: [Qemu-devel] [RFC V4 00/30] QCOW2 deduplication, Troy Benjegerdes, 2013/01/02