Merge pull request #10203 from Yan-waller/yj-wip-rgwcache-0708

rgw: merge setting flags operation together and cleanups

Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2016-08-08 14:45:48 -04:00 committed by GitHub
commit 29ff40ecd3
3 changed files with 16 additions and 13 deletions

View File

@ -27,7 +27,8 @@ int ObjectCache::get(string& name, ObjectCacheInfo& info, uint32_t mask, rgw_cac
ObjectCacheEntry *entry = &iter->second;
if (lru_counter - entry->lru_promotion_ts > lru_window) {
ldout(cct, 20) << "cache get: touching lru, lru_counter=" << lru_counter << " promotion_ts=" << entry->lru_promotion_ts << dendl;
ldout(cct, 20) << "cache get: touching lru, lru_counter=" << lru_counter
<< " promotion_ts=" << entry->lru_promotion_ts << dendl;
lock.unlock();
lock.get_write(); /* promote lock to writer */
@ -48,11 +49,15 @@ int ObjectCache::get(string& name, ObjectCacheInfo& info, uint32_t mask, rgw_cac
ObjectCacheInfo& src = iter->second.info;
if ((src.flags & mask) != mask) {
ldout(cct, 10) << "cache get: name=" << name << " : type miss (requested=" << mask << ", cached=" << src.flags << ")" << dendl;
ldout(cct, 10) << "cache get: name=" << name << " : type miss (requested=0x"
<< std::hex << mask << ", cached=0x" << src.flags
<< std::dec << ")" << dendl;
if(perfcounter) perfcounter->inc(l_rgw_cache_miss);
return -ENOENT;
}
ldout(cct, 10) << "cache get: name=" << name << " : hit (requested=" << mask << ", cached=" << src.flags << ")" << dendl;
ldout(cct, 10) << "cache get: name=" << name << " : hit (requested=0x"
<< std::hex << mask << ", cached=0x" << src.flags
<< std::dec << ")" << dendl;
info = src;
if (cache_info) {
@ -119,7 +124,8 @@ void ObjectCache::put(string& name, ObjectCacheInfo& info, rgw_cache_entry_info
return;
}
ldout(cct, 10) << "cache put: name=" << name << " info.flags=" << info.flags << dendl;
ldout(cct, 10) << "cache put: name=" << name << " info.flags=0x"
<< std::hex << info.flags << std::dec << dendl;
map<string, ObjectCacheEntry>::iterator iter = cache_map.find(name);
if (iter == cache_map.end()) {
ObjectCacheEntry entry;

View File

@ -377,7 +377,7 @@ int RGWCache<T>::system_obj_set_attrs(void *ctx, rgw_obj& obj,
if (r < 0)
mydout(0) << "ERROR: failed to distribute cache for " << obj << dendl;
} else {
cache.remove(name);
cache.remove(name);
}
return ret;
@ -396,9 +396,8 @@ int RGWCache<T>::put_system_obj_impl(rgw_obj& obj, uint64_t size, real_time *mti
ObjectCacheInfo info;
info.xattrs = attrs;
info.status = 0;
info.flags = CACHE_FLAG_XATTRS;
info.data = data;
info.flags |= CACHE_FLAG_DATA | CACHE_FLAG_META;
info.flags = CACHE_FLAG_XATTRS | CACHE_FLAG_DATA | CACHE_FLAG_META;
if (objv_tracker) {
info.version = objv_tracker->write_version;
info.flags |= CACHE_FLAG_OBJV;
@ -418,7 +417,7 @@ int RGWCache<T>::put_system_obj_impl(rgw_obj& obj, uint64_t size, real_time *mti
if (r < 0)
mydout(0) << "ERROR: failed to distribute cache for " << obj << dendl;
} else {
cache.remove(name);
cache.remove(name);
}
return ret;
@ -448,7 +447,7 @@ int RGWCache<T>::put_system_obj_data(void *ctx, rgw_obj& obj, bufferlist& data,
if (r < 0)
mydout(0) << "ERROR: failed to distribute cache for " << obj << dendl;
} else {
cache.remove(name);
cache.remove(name);
}
}
@ -527,8 +526,7 @@ int RGWCache<T>::distribute_cache(const string& normal_name, rgw_obj& obj, Objec
info.obj = obj;
bufferlist bl;
::encode(info, bl);
int ret = T::distribute(normal_name, bl);
return ret;
return T::distribute(normal_name, bl);
}
template <class T>

View File

@ -10971,8 +10971,7 @@ int RGWRados::distribute(const string& key, bufferlist& bl)
pick_control_oid(key, notify_oid);
ldout(cct, 10) << "distributing notification oid=" << notify_oid << " bl.length()=" << bl.length() << dendl;
int r = control_pool_ctx.notify2(notify_oid, bl, 0, NULL);
return r;
return control_pool_ctx.notify2(notify_oid, bl, 0, NULL);
}
int RGWRados::pool_iterate_begin(rgw_bucket& bucket, RGWPoolIterCtx& ctx)