[libvirt] [PATCH v2 4/4] conf: Optimize the iothreadid initialization

Peter Krempa pkrempa at redhat.com
Fri Oct 16 05:06:42 UTC 2015


On Thu, Oct 15, 2015 at 16:43:55 -0400, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1264008

[...]

> ---
>  src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++--------
>  1 file changed, 31 insertions(+), 8 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 70b2afc..3e15dcc 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

[...]

> @@ -2341,19 +2344,39 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def)
>      if (def->iothreads == def->niothreadids)
>          return 0;
>  
> -    while (def->niothreadids != def->iothreads) {
> -        if (!virDomainIOThreadIDFind(def, iothread_id)) {
> -            virDomainIOThreadIDDefPtr iothrid;
> +    /* iothread's are numbered starting at 1, account for that */
> +    thrmap = virBitmapNew(def->iothreads + 1);

You want to check whether the allocation succeeded ...

> +    virBitmapSetAll(thrmap);

... or this will crash.

>  
> -            if (!(iothrid = virDomainIOThreadIDAdd(def, iothread_id)))
> -                goto error;
> -            iothrid->autofill = true;

ACK,

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151016/04da0610/attachment-0001.sig>


More information about the libvir-list mailing list