From 897d56561e6e6484f6ebe968fb012521b784bfd6 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Wed, 12 Oct 2011 14:56:41 -0600 Subject: [PATCH] Allow non-shared memory caching when there are no cache_dirs. Before this change, we destroyed unused/idle StoreEntries if nobody was voting to keep them in store_table. That blocked non-shared memory cache from getting new entries if there were no cache_dirs to vote for them, which is wrong. The new code keeps unused/idle StoreEntries in store_table if nobody objects. --- src/store_dir.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store_dir.cc b/src/store_dir.cc index 84223a1b11..92ba9a1ddd 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -684,16 +684,16 @@ StoreController::reference(StoreEntry &e) bool StoreController::dereference(StoreEntry & e) { - bool keepInStoreTable = false; + bool keepInStoreTable = true; // keep if there are no objections /* Notify the fs that we're not referencing this object any more */ if (e.swap_filen > -1) - keepInStoreTable = swapDir->dereference(e) || keepInStoreTable; + keepInStoreTable = swapDir->dereference(e) && keepInStoreTable; // Notify the memory cache that we're not referencing this object any more if (memStore && e.mem_status == IN_MEMORY) - keepInStoreTable = memStore->dereference(e) || keepInStoreTable; + keepInStoreTable = memStore->dereference(e) && keepInStoreTable; // TODO: move this code to a non-shared memory cache class when we have it if (e.mem_obj) { -- 2.47.3