chiark / gitweb /
journal: special case the trivial cache chain cache entry
[elogind.git] / src / journal / journal-file.c
index 6c9deacf2ce1c26ccbe94e9b7fcaff070b86961b..3df099dbd2f3af936713cb413bdb448265a30b2e 100644 (file)
@@ -1328,6 +1328,11 @@ static void chain_cache_put(
                 uint64_t total) {
 
         if (!ci) {
+                /* If the chain item to cache for this chain is the
+                 * first one it's not worth caching anything */
+                if (array == first)
+                        return;
+
                 if (hashmap_size(h) >= CHAIN_CACHE_MAX)
                         ci = hashmap_steal_first(h);
                 else {