summaryrefslogtreecommitdiff
path: root/src/nm-route-manager.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-06-21 10:53:34 +0200
committerThomas Haller <thaller@redhat.com>2017-06-26 11:48:27 +0200
commitcb85c36b204232870357844ab915a65b9e38ef4a (patch)
tree9f455f4784ac4987741971d010043fbb5f68625d /src/nm-route-manager.c
parentdcdfca3e1e0e42d397745e73ab5004328fc12f41 (diff)
downloadNetworkManager-th/dedup-multi.tar.gz
platform: use NMDedupMultiIndex for routes in NMPCacheth/dedup-multi
Rework platform object cache to use NMDedupMultiIndex. Already previously, NMPCache used NMMultiIndex and had thus O(1) for most operations. What is new is: - NMDedupMultiIndex preserves the order of the cached items. This is important to handle routes properly as kernel will replace the first matching route based on network/plen/metric properties. See related bug rh#1337855. Without tracking the order of routes as they are exposed by kernel, we cannot properly maintain the route cache. - All NMPObject instances are now treated immutable, refcounted and get de-duplicated via NMDedupMultiIndex. This allows to have a global NMDedupMultiIndex that can be shared with NMIP4Config and NMRouteManager. It also allows to share the objects themselves. Immutable objects are so much nicer. We can get rid of the update pre-hook callback, which was required previously because we would mutate the object inplace. Now, we can just update the cache, and compare obj_old and obj_new after the fact. - NMMultiIndex was treated as an internal of NMPCache. On the other hand, NMDedupMultiIndex exposes NMDedupMultiHeadEntry, which is basically an object that allows to iterate over all related objects. That means, we can now lookup objects in the cache and give the NMDedupMultiHeadEntry instance to the caller, which then can iterate the list on it's own -- without need for copying anything. Currently, at various places we still create copies of lookup results. That can be improved later. The ability to share NMPObject instances should enable us to significantly improve performance and scale with large number of routes.
Diffstat (limited to 'src/nm-route-manager.c')
-rw-r--r--src/nm-route-manager.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nm-route-manager.c b/src/nm-route-manager.c
index b58cdeb069..6c1f78ac96 100644
--- a/src/nm-route-manager.c
+++ b/src/nm-route-manager.c
@@ -1173,7 +1173,7 @@ nm_route_manager_ip4_route_register_device_route_purge_list (NMRouteManager *sel
? "update" : "new",
nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
g_hash_table_replace (priv->ip4_device_routes.entries,
- nmp_object_ref (entry->obj),
+ (NMPObject *) nmp_object_ref (entry->obj),
entry);
}
if (priv->ip4_device_routes.gc_id == 0) {