Merge pull request #19768 from cbodley/wip-rgw-cache-dedeque

rgw: change ObjectCache::lru from deque back to list
This commit is contained in:
Matt Benjamin 2018-01-03 17:19:16 -05:00 committed by GitHub
commit 6b72f45613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -134,6 +134,8 @@ void ObjectCache::put(string& name, ObjectCacheInfo& info, rgw_cache_entry_info
ObjectCacheEntry& entry = iter->second;
ObjectCacheInfo& target = entry.info;
invalidate_lru(entry);
entry.chained_entries.clear();
entry.gen++;
@ -209,7 +211,7 @@ void ObjectCache::remove(string& name)
}
void ObjectCache::touch_lru(string& name, ObjectCacheEntry& entry,
std::deque<string>::iterator& lru_iter)
std::list<string>::iterator& lru_iter)
{
while (lru_size > (size_t)cct->_conf->rgw_cache_lru_size) {
auto iter = lru.begin();
@ -249,7 +251,7 @@ void ObjectCache::touch_lru(string& name, ObjectCacheEntry& entry,
}
void ObjectCache::remove_lru(string& name,
std::deque<string>::iterator& lru_iter)
std::list<string>::iterator& lru_iter)
{
if (lru_iter == lru.end())
return;

View File

@ -128,7 +128,7 @@ WRITE_CLASS_ENCODER(RGWCacheNotifyInfo)
struct ObjectCacheEntry {
ObjectCacheInfo info;
std::deque<string>::iterator lru_iter;
std::list<string>::iterator lru_iter;
uint64_t lru_promotion_ts;
uint64_t gen;
std::vector<pair<RGWChainedCache *, string> > chained_entries;
@ -138,7 +138,7 @@ struct ObjectCacheEntry {
class ObjectCache {
std::unordered_map<string, ObjectCacheEntry> cache_map;
std::deque<string> lru;
std::list<string> lru;
unsigned long lru_size;
unsigned long lru_counter;
unsigned long lru_window;
@ -151,8 +151,8 @@ class ObjectCache {
ceph::timespan expiry;
void touch_lru(string& name, ObjectCacheEntry& entry,
std::deque<string>::iterator& lru_iter);
void remove_lru(string& name, std::deque<string>::iterator& lru_iter);
std::list<string>::iterator& lru_iter);
void remove_lru(string& name, std::list<string>::iterator& lru_iter);
void invalidate_lru(ObjectCacheEntry& entry);
void do_invalidate_all();