[libvirt PATCH 2/4] qemu: simplify qemuDomainGetMemLockLimitBytes()

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

 



This function goes through a loop checking if each hostdev is a VFIO
or mdev device, and then later it calls virDomainDefHasNVMEDisk(). The
function qemuDomainNeedsVFIO() does exactly the same thing, so let's
just call that instead.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5f0c7f0531..5238a52095 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9258,8 +9258,6 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
                                bool forceVFIO)
 {
     unsigned long long memKB = 0;
-    bool usesVFIO = false;
-    size_t i;
 
     /* prefer the hard limit */
     if (virMemoryLimitIsSet(def->mem.hard_limit)) {
@@ -9296,20 +9294,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
      *
      * Note that this may not be valid for all platforms.
      */
-    if (!forceVFIO) {
-        for (i = 0; i < def->nhostdevs; i++) {
-            if (virHostdevIsVFIODevice(def->hostdevs[i]) ||
-                virHostdevIsMdevDevice(def->hostdevs[i])) {
-                usesVFIO = true;
-                break;
-            }
-        }
-
-        if (virDomainDefHasNVMeDisk(def))
-            usesVFIO = true;
-    }
-
-    if (usesVFIO || forceVFIO)
+    if (forceVFIO || qemuDomainNeedsVFIO(def))
         memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
 
     return memKB << 10;
-- 
2.30.2




[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]

  Powered by Linux