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.
This commit is contained in:
John Ferlan 2015-04-23 14:01:48 -04:00
parent 5bb343f355
commit c6e2dc800d
3 changed files with 25 additions and 0 deletions

View File

@ -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 virDomainPinDefPtr
virDomainPinFind(virDomainPinDefPtr *def, virDomainPinFind(virDomainPinDefPtr *def,
int npin, int npin,

View File

@ -2617,6 +2617,7 @@ virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(virDomainDefPtr def,
virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def, virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def,
unsigned int iothread_id); unsigned int iothread_id);
void virDomainIOThreadIDDel(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); unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);

View File

@ -328,6 +328,7 @@ virDomainIOThreadIDAdd;
virDomainIOThreadIDDefFree; virDomainIOThreadIDDefFree;
virDomainIOThreadIDDel; virDomainIOThreadIDDel;
virDomainIOThreadIDFind; virDomainIOThreadIDFind;
virDomainIOThreadSchedDelId;
virDomainLeaseDefFree; virDomainLeaseDefFree;
virDomainLeaseIndex; virDomainLeaseIndex;
virDomainLeaseInsert; virDomainLeaseInsert;