[PATCH v1 31/31] parallels_network: Drop parallelsDriverLock() from everywhere.

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

 



While in previous commits there were some places that relied on
the big lock, in this file there's no such place and the big
driver lock can be dropped completely. Yay!

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/parallels/parallels_network.c | 33 +--------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index da29060..d7bd818 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -337,9 +337,7 @@ parallelsNetworkOpen(virConnectPtr conn,
 int parallelsNetworkClose(virConnectPtr conn)
 {
     parallelsConnPtr privconn = conn->privateData;
-    parallelsDriverLock(privconn);
     virObjectUnref(privconn->networks);
-    parallelsDriverUnlock(privconn);
     return 0;
 }
 
@@ -348,11 +346,8 @@ static int parallelsConnectNumOfNetworks(virConnectPtr conn)
     int nactive;
     parallelsConnPtr privconn = conn->privateData;
 
-    parallelsDriverLock(privconn);
     nactive = virNetworkObjListNumOfNetworks(privconn->networks,
                                              true, NULL, conn);
-    parallelsDriverUnlock(privconn);
-
     return nactive;
 }
 
@@ -363,11 +358,8 @@ static int parallelsConnectListNetworks(virConnectPtr conn,
     parallelsConnPtr privconn = conn->privateData;
     int got;
 
-    parallelsDriverLock(privconn);
     got = virNetworkObjListGetNames(privconn->networks,
                                     true, names, nnames, NULL, conn);
-    parallelsDriverUnlock(privconn);
-
     return got;
 }
 
@@ -376,11 +368,8 @@ static int parallelsConnectNumOfDefinedNetworks(virConnectPtr conn)
     int ninactive;
     parallelsConnPtr privconn = conn->privateData;
 
-    parallelsDriverLock(privconn);
     ninactive = virNetworkObjListNumOfNetworks(privconn->networks,
                                                false, NULL, conn);
-    parallelsDriverUnlock(privconn);
-
     return ninactive;
 }
 
@@ -391,10 +380,8 @@ static int parallelsConnectListDefinedNetworks(virConnectPtr conn,
     parallelsConnPtr privconn = conn->privateData;
     int got;
 
-    parallelsDriverLock(privconn);
     got = virNetworkObjListGetNames(privconn->networks,
                                     false, names, nnames, NULL, conn);
-    parallelsDriverUnlock(privconn);
     return got;
 }
 
@@ -403,15 +390,10 @@ static int parallelsConnectListAllNetworks(virConnectPtr conn,
                                            unsigned int flags)
 {
     parallelsConnPtr privconn = conn->privateData;
-    int ret = -1;
 
     virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
 
-    parallelsDriverLock(privconn);
-    ret = virNetworkObjListExport(conn, privconn->networks, nets, NULL, flags);
-    parallelsDriverUnlock(privconn);
-
-    return ret;
+    return virNetworkObjListExport(conn, privconn->networks, nets, NULL, flags);
 }
 
 static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
@@ -421,9 +403,7 @@ static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
     virNetworkObjPtr network;
     virNetworkPtr ret = NULL;
 
-    parallelsDriverLock(privconn);
     network = virNetworkObjFindByUUID(privconn->networks, uuid);
-    parallelsDriverUnlock(privconn);
     if (!network) {
         virReportError(VIR_ERR_NO_NETWORK,
                        "%s", _("no network with matching uuid"));
@@ -444,9 +424,7 @@ static virNetworkPtr parallelsNetworkLookupByName(virConnectPtr conn,
     virNetworkObjPtr network;
     virNetworkPtr ret = NULL;
 
-    parallelsDriverLock(privconn);
     network = virNetworkObjFindByName(privconn->networks, name);
-    parallelsDriverUnlock(privconn);
     if (!network) {
         virReportError(VIR_ERR_NO_NETWORK,
                        _("no network with matching name '%s'"), name);
@@ -469,10 +447,7 @@ static char *parallelsNetworkGetXMLDesc(virNetworkPtr net,
 
     virCheckFlags(VIR_NETWORK_XML_INACTIVE, NULL);
 
-    parallelsDriverLock(privconn);
     network = virNetworkObjFindByUUID(privconn->networks, net->uuid);
-    parallelsDriverUnlock(privconn);
-
     if (!network) {
         virReportError(VIR_ERR_NO_NETWORK,
                        "%s", _("no network with matching uuid"));
@@ -492,9 +467,7 @@ static int parallelsNetworkIsActive(virNetworkPtr net)
     virNetworkObjPtr obj;
     int ret = -1;
 
-    parallelsDriverLock(privconn);
     obj = virNetworkObjFindByUUID(privconn->networks, net->uuid);
-    parallelsDriverUnlock(privconn);
     if (!obj) {
         virReportError(VIR_ERR_NO_NETWORK, NULL);
         goto cleanup;
@@ -512,9 +485,7 @@ static int parallelsNetworkIsPersistent(virNetworkPtr net)
     virNetworkObjPtr obj;
     int ret = -1;
 
-    parallelsDriverLock(privconn);
     obj = virNetworkObjFindByUUID(privconn->networks, net->uuid);
-    parallelsDriverUnlock(privconn);
     if (!obj) {
         virReportError(VIR_ERR_NO_NETWORK, NULL);
         goto cleanup;
@@ -533,9 +504,7 @@ static int parallelsNetworkGetAutostart(virNetworkPtr net,
     virNetworkObjPtr network;
     int ret = -1;
 
-    parallelsDriverLock(privconn);
     network = virNetworkObjFindByUUID(privconn->networks, net->uuid);
-    parallelsDriverUnlock(privconn);
     if (!network) {
         virReportError(VIR_ERR_NO_NETWORK,
                        "%s", _("no network with matching uuid"));
-- 
2.0.5

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