]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't remove tail of lru if that's what we touch
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 22 Nov 2011 18:31:25 +0000 (10:31 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 22 Nov 2011 18:31:25 +0000 (10:31 -0800)
src/rgw/rgw_cache.cc

index 1c5e0479d40bb7d291c02ee926f3a522cefb44ac..6035fca9d2908332fe8f9dad2bca08f9baa9c3cb 100644 (file)
@@ -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())