qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [QEMU RFC PATCH v3 4/6] Migration: migrate QTAILQ


From: Paolo Bonzini
Subject: Re: [Qemu-ppc] [QEMU RFC PATCH v3 4/6] Migration: migrate QTAILQ
Date: Wed, 1 Jun 2016 20:32:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0


On 01/06/2016 19:06, Jianjun Duan wrote:
> On 06/01/2016 08:29 AM, Paolo Bonzini wrote:
>> On 31/05/2016 23:53, Jianjun Duan wrote:
>>> On 05/31/2016 12:54 PM, Paolo Bonzini wrote:
>>>>> +/* put for QTAILQ */
>>>>> +static void put_qtailq(QEMUFile *f, void *pv, size_t unused_size,
>>>>> +                       VMStateField *field, QJSON *vmdesc)
>>>>> +{
>>>>> +    bool link = true;
>>>>> +    const VMStateDescription *vmsd = field->vmsd;
>>>>> +    size_t entry = field->start;
>>>>> +    void *elm;
>>>>> +
>>>>> +    if (vmdesc) {
>>>>> +        json_prop_str(vmdesc, "vmsd_name", vmsd->name);
>>>>> +        json_prop_int(vmdesc, "version", vmsd->version_id);
>>>>> +        json_start_array(vmdesc, "fields");
>>>>
>>>> You need to store the fields exactly once here, even if there are
>>>> 0 or >1 elements.
>>>>
>>> Do you mean the json entries? I think it is already doing that.
>>
>> In the case of 0 entries we don't go through the loop, so the JSON
>> entries are definitely missing in that case.  I'm not sure if QJSON
>> handles duplicates in the case of 2+ entries.
> 
> The vmsd here is the vmsd for the queue elements. Not for the queue.
> Maybe the stuff written here should be information about the qtailq
> instead, but we don't have a vmsd for the queue as a whole.

You're right, you could use vmsd_can_compress but it's not necessary to
do so.  Your code is fine.

Paolo



reply via email to

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