summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2011-11-22 10:31:25 -0800
committerYehuda Sadeh <yehuda@hq.newdream.net>2011-11-22 10:31:25 -0800
commita859763b1cba844d0d56b861a372e5f63f87c607 (patch)
tree485f02044e1dd6ae73bb00a61d30bbad85a3d51e
parenteb8d91feaf440a2d9bd8f54f3b72b61d73fc0fee (diff)
downloadceph-a859763b1cba844d0d56b861a372e5f63f87c607.tar.gz
rgw: don't remove tail of lru if that's what we touch
-rw-r--r--src/rgw/rgw_cache.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rgw/rgw_cache.cc b/src/rgw/rgw_cache.cc
index 1c5e0479d40..6035fca9d29 100644
--- a/src/rgw/rgw_cache.cc
+++ b/src/rgw/rgw_cache.cc
@@ -103,6 +103,13 @@ void ObjectCache::touch_lru(string& name, std::list<string>::iterator& lru_iter)
{
while (lru.size() > (size_t)g_conf->rgw_cache_lru_size) {
list<string>::iterator iter = lru.begin();
+ if ((*iter).compare(name) == 0) {
+ /*
+ * if the entry we're touching happens to be at the lru end, don't remove it,
+ * lru shrinking can wait for next time
+ */
+ break;
+ }
map<string, ObjectCacheEntry>::iterator map_iter = cache_map.find(*iter);
dout(10) << "removing entry: name=" << *iter << " from cache LRU" << dendl;
if (map_iter != cache_map.end())