[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-4.2 05/13] qcow2: Write v3-compliant snapsho
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH for-4.2 05/13] qcow2: Write v3-compliant snapshot list on upgrade |
Date: |
Wed, 31 Jul 2019 10:56:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 30.07.19 20:10, Eric Blake wrote:
> On 7/30/19 12:25 PM, Max Reitz wrote:
>> qcow2 v3 requires every snapshot table entry to have two extra data
>> fields: The 64-bit VM state size, and the virtual disk size. Both are
>> optional for v2 images, so they may not be present.
>>
>> qcow2_upgrade() therefore should update the snapshot table to ensure all
>> entries have these extra data fields.
>>
>> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1727347
>> Reported-by: Eric Blake <address@hidden>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> block/qcow2.c | 29 +++++++++++++++++++++++++++--
>> 1 file changed, 27 insertions(+), 2 deletions(-)
>>
>
>> +
>> + /*
>> + * In v2, snapshots do not need to have extra data. v3 requires
>> + * the 64-bit VM state size and the virtual disk size to be
>> + * present.
>> + * qcow2_write_snapshots() will always write the list in the
>> + * v3-compliant format.
>> + */
>> + need_snapshot_update = false;
>> + for (i = 0; i < s->nb_snapshots; i++) {
>> + if (s->snapshots[i].extra_data_size < 16) {
>
> s/16/sizeof(extra)/ looks a bit nicer, but doesn't change semantics.
Hm, but it’s not quite right. I mean, right now it is, but if we were
to add a new field to snapshot metadata, it wouldn’t be. It should be 16.
I can make it something like sizeof(extra.vm_state_size_large) +
sizeof(extra.disk_size), though.
Max
> Reviewed-by: Eric Blake <address@hidden>
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH for-4.2 01/13] qcow2: Add Error ** to qcow2_read_snapshots(), (continued)
- [Qemu-devel] [PATCH for-4.2 02/13] qcow2: Keep unknown extra snapshot data, Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 03/13] qcow2: Make qcow2_write_snapshots() public, Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 04/13] qcow2: Put qcow2_upgrade() into an own function, Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 05/13] qcow2: Write v3-compliant snapshot list on upgrade, Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 06/13] qcow2: Separate qcow2_check_read_snapshot_table(), Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 07/13] qcow2: Add qcow2_check_fix_snapshot_table(), Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 08/13] qcow2: Fix broken snapshot table entries, Max Reitz, 2019/07/30
- [Qemu-devel] [PATCH for-4.2 10/13] qcow2: Repair snapshot table with too many entries, Max Reitz, 2019/07/30