chiark / gitweb /
journal: special case the trivial cache chain cache entry
authorLennart Poettering <lennart@poettering.net>
Fri, 26 Oct 2012 18:25:36 +0000 (20:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 26 Oct 2012 18:25:36 +0000 (20:25 +0200)
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 {