]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
domain: Introduce virDomainIOThreadSchedDelId
authorJohn Ferlan <jferlan@redhat.com>
Thu, 23 Apr 2015 18:01:48 +0000 (14:01 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 27 Apr 2015 16:36:36 +0000 (12:36 -0400)
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
src/conf/domain_conf.h
src/libvirt_private.syms

index 7da94bb5f3c0dbd35df3027721a6455f14412913..0b187205d545134c10aa72cedf57de5b80c94e2c 100644 (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
 virDomainPinFind(virDomainPinDefPtr *def,
                  int npin,
index f60f7a073eaac12e4bc8b4cdf77a98a795eb03b5..0761eee3f62446f4d076bfbc95e10f5dfc835a10 100644 (file)
@@ -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);
 
index f3d2c38debdc9a118d78d6b5e2f3d0b2c32ae59e..2042c8a486a295609521538cd7885a6b5cbc2e5f 100644 (file)
@@ -328,6 +328,7 @@ virDomainIOThreadIDAdd;
 virDomainIOThreadIDDefFree;
 virDomainIOThreadIDDel;
 virDomainIOThreadIDFind;
+virDomainIOThreadSchedDelId;
 virDomainLeaseDefFree;
 virDomainLeaseIndex;
 virDomainLeaseInsert;