[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 04/16] qcow2: Keep unknown extra snapshot dat
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v2 04/16] qcow2: Keep unknown extra snapshot data |
Date: |
Tue, 20 Aug 2019 13:42:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 19.08.19 21:23, Eric Blake wrote:
> On 8/19/19 1:55 PM, Max Reitz wrote:
>> The qcow2 specification says to ignore unknown extra data fields in
>> snapshot table entries. Currently, we discard it whenever we update the
>> image, which is a bit different from "ignore".
>>
>> This patch makes the qcow2 driver keep all unknown extra data fields
>> when updating an image's snapshot table.
>>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> block/qcow2.h | 5 ++++
>> block/qcow2-snapshot.c | 61 +++++++++++++++++++++++++++++++++++-------
>> 2 files changed, 56 insertions(+), 10 deletions(-)
>>
>
>> @@ -162,7 +184,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
>> sn = s->snapshots + i;
>> offset = ROUND_UP(offset, 8);
>> offset += sizeof(h);
>> - offset += sizeof(extra);
>> + offset += MAX(sizeof(extra), sn->extra_data_size);
>
> Why would we ever have less than sizeof(extra) bytes to write on output,
> since we always produce the fields on creation and synthesize the
> missing fields of extra on read? Can't you rewrite this as:
>
> assert(sn->extra_data_size >= sizeof(extra));
> offset += sn->extra_data_size;
Hm, but I don’t prop up extra_data_size to be at least sizeof(extra). I
can do that, but it would add a few extra lines here and there.
> Otherwise,
>
> Reviewed-by: Eric Blake <address@hidden>
In any case, thanks for reviewing again :-)
Max
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 00/16] qcow2: Let check -r all repair some snapshot bits, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 01/16] include: Move endof() up from hw/virtio/virtio.h, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof(), Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 03/16] qcow2: Add Error ** to qcow2_read_snapshots(), Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 04/16] qcow2: Keep unknown extra snapshot data, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 05/16] qcow2: Make qcow2_write_snapshots() public, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 06/16] qcow2: Put qcow2_upgrade() into its own function, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 07/16] qcow2: Write v3-compliant snapshot list on upgrade, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 08/16] qcow2: Separate qcow2_check_read_snapshot_table(), Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 09/16] qcow2: Add qcow2_check_fix_snapshot_table(), Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 11/16] qcow2: Keep track of the snapshot table length, Max Reitz, 2019/08/19