diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2011-11-22 10:31:25 -0800 |
---|---|---|
committer | Yehuda Sadeh <yehuda@hq.newdream.net> | 2011-11-22 10:31:25 -0800 |
commit | a859763b1cba844d0d56b861a372e5f63f87c607 (patch) | |
tree | 485f02044e1dd6ae73bb00a61d30bbad85a3d51e | |
parent | eb8d91feaf440a2d9bd8f54f3b72b61d73fc0fee (diff) | |
download | ceph-a859763b1cba844d0d56b861a372e5f63f87c607.tar.gz |
rgw: don't remove tail of lru if that's what we touch
-rw-r--r-- | src/rgw/rgw_cache.cc | 7 |
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()) |