From nobody Sun Feb 8 21:29:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1487343235793650.2651033473583; Fri, 17 Feb 2017 06:53:55 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HEnWNE042640; Fri, 17 Feb 2017 09:49:32 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1HEnLsS003684 for ; Fri, 17 Feb 2017 09:49:21 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HEnImx022242 for ; Fri, 17 Feb 2017 09:49:20 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Fri, 17 Feb 2017 15:49:06 +0100 Message-Id: <898c38bae40be5196ccb607a6d2b9816a5e6a3f1.1487341781.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/13] conf: remove redundant iothreads variable X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 32 +++++++++++++++++--------------- src/conf/domain_conf.h | 1 - src/qemu/qemu_driver.c | 6 ------ src/qemu/qemu_process.c | 1 - 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a179c1e278..71cd572a30 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2558,7 +2558,8 @@ virDomainIOThreadIDDefArrayFree(virDomainIOThreadIDDe= fPtr *def, =20 =20 static int -virDomainIOThreadIDDefArrayInit(virDomainDefPtr def) +virDomainIOThreadIDDefArrayInit(virDomainDefPtr def, + unsigned int iothreads) { int retval =3D -1; size_t i; @@ -2569,11 +2570,11 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def) /* Same value (either 0 or some number), then we have none to fill in = or * the iothreadid array was filled from the XML */ - if (def->iothreads =3D=3D def->niothreadids) + if (iothreads =3D=3D def->niothreadids) return 0; =20 /* iothread's are numbered starting at 1, account for that */ - if (!(thrmap =3D virBitmapNew(def->iothreads + 1))) + if (!(thrmap =3D virBitmapNew(iothreads + 1))) goto error; virBitmapSetAll(thrmap); =20 @@ -2585,11 +2586,11 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def) def->iothreadids[i]->iothread_id)); =20 /* resize array */ - if (VIR_REALLOC_N(def->iothreadids, def->iothreads) < 0) + if (VIR_REALLOC_N(def->iothreadids, iothreads) < 0) goto error; =20 /* Populate iothreadids[] using the set bit number from thrmap */ - while (def->niothreadids < def->iothreads) { + while (def->niothreadids < iothreads) { if ((nxt =3D virBitmapNextSetBit(thrmap, nxt)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to populate iothreadids")); @@ -16755,8 +16756,9 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; =20 /* Optional - iothreads */ + unsigned int iothreads; tmp =3D virXPathString("string(./iothreads[1])", ctxt); - if (tmp && virStrToLong_uip(tmp, NULL, 10, &def->iothreads) < 0) { + if (tmp && virStrToLong_uip(tmp, NULL, 10, &iothreads) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid iothreads count '%s'"), tmp); goto error; @@ -16767,8 +16769,8 @@ virDomainDefParseXML(xmlDocPtr xml, if ((n =3D virXPathNodeSet("./iothreadids/iothread", ctxt, &nodes)) < = 0) goto error; =20 - if (n > def->iothreads) - def->iothreads =3D n; + if (n > iothreads) + iothreads =3D n; =20 if (n && VIR_ALLOC_N(def->iothreadids, n) < 0) goto error; @@ -16789,7 +16791,7 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(nodes); =20 - if (virDomainIOThreadIDDefArrayInit(def) < 0) + if (virDomainIOThreadIDDefArrayInit(def, iothreads) < 0) goto error; =20 /* Extract cpu tunables. */ @@ -19487,11 +19489,11 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPt= r src, if (!virDomainDefVcpuCheckAbiStability(src, dst)) goto error; =20 - if (src->iothreads !=3D dst->iothreads) { + if (src->niothreadids !=3D dst->niothreadids) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain iothreads count %u does not " - "match source %u"), - dst->iothreads, src->iothreads); + _("Target domain iothreads count %lu does not " + "match source %lu"), + dst->niothreadids, src->niothreadids); goto error; } =20 @@ -23812,8 +23814,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, goto error; =20 if (def->niothreadids > 0) { - virBufferAsprintf(buf, "%u\n", - def->iothreads); + virBufferAsprintf(buf, "%lu\n", + def->niothreadids); /* Only print out iothreadids if we read at least one */ for (i =3D 0; i < def->niothreadids; i++) { if (!def->iothreadids[i]->autofill) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index dd79206f69..8ff2de8c25 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2210,7 +2210,6 @@ struct _virDomainDef { int placement_mode; virBitmapPtr cpumask; =20 - unsigned int iothreads; size_t niothreadids; virDomainIOThreadIDDefPtr *iothreadids; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index afbcded93f..661f6f5d34 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5617,10 +5617,8 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver, _("got wrong number of IOThread ids from QEMU monit= or. " "got %d, wanted %d"), new_niothreads, exp_niothreads); - vm->def->iothreads =3D new_niothreads; goto cleanup; } - vm->def->iothreads =3D exp_niothreads; =20 /* * If we've successfully added an IOThread, find out where we added it @@ -5716,10 +5714,8 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, _("got wrong number of IOThread ids from QEMU monit= or. " "got %d, wanted %d"), new_niothreads, exp_niothreads); - vm->def->iothreads =3D new_niothreads; goto cleanup; } - vm->def->iothreads =3D exp_niothreads; =20 virDomainIOThreadIDDel(vm->def, iothread_id); =20 @@ -5798,7 +5794,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, if (!virDomainIOThreadIDAdd(persistentDef, iothread_id)) goto endjob; =20 - persistentDef->iothreads++; } else { virDomainIOThreadIDDefPtr iothrid; if (!(iothrid =3D virDomainIOThreadIDFind(persistentDef, @@ -5811,7 +5806,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, } =20 virDomainIOThreadIDDel(persistentDef, iothread_id); - persistentDef->iothreads--; } =20 if (virDomainSaveConfig(cfg->configDir, driver->caps, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 76f132bc8f..62f0b9b630 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2123,7 +2123,6 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, /* Remove any trace */ VIR_FREE(vm->def->iothreadids); vm->def->niothreadids =3D 0; - vm->def->iothreads =3D 0; } return 0; } --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list