[PATCH] qemu: bulk stats: Clean up code to check whether we need a domain job

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Storing the information as a flag in a unsigned int seems a bit
wasteful. Store it in a bool instead.
---
 src/qemu/qemu_driver.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index df3ba6d..5c60127 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18691,7 +18691,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
     int nstats = 0;
     size_t i;
     int ret = -1;
-    unsigned int privflags = 0;
+    bool needjob;
     unsigned int domflags = 0;

     if (ndoms)
@@ -18727,8 +18727,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
     if (VIR_ALLOC_N(tmpstats, ndoms + 1) < 0)
         goto cleanup;

-    if (qemuDomainGetStatsNeedMonitor(stats))
-        privflags |= QEMU_DOMAIN_STATS_HAVE_JOB;
+    bool needjob = qemuDomainGetStatsNeedMonitor(stats);

     for (i = 0; i < ndoms; i++) {
         virDomainStatsRecordPtr tmp = NULL;
@@ -18744,7 +18743,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
             continue;
         }

-        if (HAVE_JOB(privflags) &&
+        if (needjob &&
             qemuDomainObjBeginJob(driver, dom, QEMU_JOB_QUERY) == 0)
             domflags |= QEMU_DOMAIN_STATS_HAVE_JOB;
         /* else: without a job it's still possible to gather some data */
-- 
2.2.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]