[libvirt] [PATCH] qemu: optimize JSON event handler lookup

Eric Blake eblake at redhat.com
Wed Apr 11 14:45:04 UTC 2012


On 04/10/2012 06:53 PM, Wen Congyang wrote:
> At 04/11/2012 06:47 AM, Eric Blake Wrote:
>> Probably in the noise, but this will let us scale more efficiently
>> as we recognize ever more qemu events.
>>
>> * src/qemu/qemu_monitor_json.c (eventHandlers): Sort.
>> (eventSearch): New helper function.
>> (qemuMonitorJSONIOProcessEvent): Optimize event lookup.
>> ---
>>
>> In reply to:
>> https://www.redhat.com/archives/libvir-list/2012-April/msg00416.html
>>

>> +static qemuEventHandler eventHandlers[] = {
>> +    { "BLOCK_IO_ERROR", qemuMonitorJSONHandleIOError, },
>> +    { "BLOCK_JOB_CANCELLED", qemuMonitorJSONHandleBlockJobCanceled, },
> 
> I donot find this event...
> 

>> -    { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJobCompleted, },
>> -    { "BLOCK_JOB_CANCELLED", qemuMonitorJSONHandleBlockJobCanceled, },

It is not in libvirt.git, but is there if you apply this patch after my
live storage migration series.  At any rate, I can certainly rebase
things correctly if we like the approach of this patch, and want it
applied now.

>> +static int
>> +eventSearch(const void *key, const void *elt) {
> 
> Hmm, I think eventCompare is better than eventSearch.

For that matter, I think I'll name things qemuMonitorEventCompare, so
that the function is in the file namespace (being static, a shorter name
doesn't matter on the technical front; but our style as of late has been
to use consistent naming even for static functions).

v2 coming up, rebased to apply without waiting on my storage migration
series.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120411/f39986d0/attachment-0001.sig>


More information about the libvir-list mailing list