qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH for-5.0 v11 01/20] migration: Support QLIST migration


From: Juan Quintela
Subject: Re: [PATCH for-5.0 v11 01/20] migration: Support QLIST migration
Date: Wed, 08 Jan 2020 14:19:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Eric Auger (address@hidden) wrote:
>> Support QLIST migration using the same principle as QTAILQ:
>> 94869d5c52 ("migration: migrate QTAILQ").
>> 
>> The VMSTATE_QLIST_V macro has the same proto as VMSTATE_QTAILQ_V.
>> The change mainly resides in QLIST RAW macros: QLIST_RAW_INSERT_HEAD
>> and QLIST_RAW_REVERSE.
>> 
>> Tests also are provided.
>> 
>> Signed-off-by: Eric Auger <address@hidden>
>> 
>> +    while (qemu_get_byte(f)) {
>> +        elm = g_malloc(size);
>> +        ret = vmstate_load_state(f, vmsd, elm, version_id);
>> +        if (ret) {
>> +            error_report("%s: failed to load %s (%d)", field->name,
>> +                         vmsd->name, ret);
>> +            g_free(elm);
>> +            return ret;
>> +        }
>> +        QLIST_RAW_INSERT_HEAD(pv, elm, entry_offset);
>> +    }
>> +    QLIST_RAW_REVERSE(pv, elm, entry_offset);
>
> Can you explain why you need to do a REVERSE on the loaded list,
> rather than using doing a QLIST_INSERT_AFTER to always insert at
> the end?
>
> Other than that it looks good.

This was my fault (integrated as this is).

Old code had a "walk to the end of the list" and then insert.
I told it was way faster just to insert and the beggining and then
reverse.  I didn't noticed that we had the previous element to know
where to insert.

Eric, feel free to send a patch on top of this, or I will do it.

Later, Juan.




reply via email to

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