From c6e2dc800d04c6c1ef9a5cf71a8111778c598991 Mon Sep 17 00:00:00 2001 From: John Ferlan <jferlan@redhat.com> Date: Thu, 23 Apr 2015 14:01:48 -0400 Subject: [PATCH] domain: Introduce virDomainIOThreadSchedDelId We're about to allow IOThreads to be deleted, but an iothreadid may be included in some domain thread sched, so add a new API to allow removing an iothread from some entry. Then during the writing of the threadsched data and an additional check to determine whether the bitmap is all clear before writing it out. --- src/conf/domain_conf.c | 23 +++++++++++++++++++++++ src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + 3 files changed, 25 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7da94bb5f3..0b187205d5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17468,6 +17468,29 @@ virDomainIOThreadIDDel(virDomainDefPtr def, } } +void +virDomainIOThreadSchedDelId(virDomainDefPtr def, + unsigned int iothreadid) +{ + size_t i; + + if (!def->cputune.iothreadsched || !def->cputune.niothreadsched) + return; + + for (i = 0; i < def->cputune.niothreadsched; i++) { + if (virBitmapIsBitSet(def->cputune.iothreadsched[i].ids, iothreadid)) { + ignore_value(virBitmapClearBit(def->cputune.iothreadsched[i].ids, + iothreadid)); + if (virBitmapIsAllClear(def->cputune.iothreadsched[i].ids)) { + virBitmapFree(def->cputune.iothreadsched[i].ids); + VIR_DELETE_ELEMENT(def->cputune.iothreadsched, i, + def->cputune.niothreadsched); + } + return; + } + } +} + virDomainPinDefPtr virDomainPinFind(virDomainPinDefPtr *def, int npin, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f60f7a073e..0761eee3f6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2617,6 +2617,7 @@ virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(virDomainDefPtr def, virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def, unsigned int iothread_id); void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id); +void virDomainIOThreadSchedDelId(virDomainDefPtr def, unsigned int iothread_id); unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f3d2c38deb..2042c8a486 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -328,6 +328,7 @@ virDomainIOThreadIDAdd; virDomainIOThreadIDDefFree; virDomainIOThreadIDDel; virDomainIOThreadIDFind; +virDomainIOThreadSchedDelId; virDomainLeaseDefFree; virDomainLeaseIndex; virDomainLeaseInsert;