From eefcc67272d67b03418d805d2a33ad92563e89e8 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 15 Apr 2016 10:25:12 -0700 Subject: [PATCH] rgw: binfo_cache is now a RGWRados member Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.cc | 16 +++++----------- src/rgw/rgw_rados.h | 13 +++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 61c2b625d52b3..1623b973f9fcc 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -106,14 +106,6 @@ static string RGW_DEFAULT_PERIOD_ROOT_POOL = "rgw.root"; #define dout_subsys ceph_subsys_rgw -struct bucket_info_entry { - RGWBucketInfo info; - real_time mtime; - map attrs; -}; - -static RGWChainedCacheImpl binfo_cache; - void RGWDefaultZoneGroupInfo::dump(Formatter *f) const { encode_json("default_zonegroup", default_zonegroup, f); } @@ -3126,6 +3118,7 @@ void RGWRados::finalize() if (cr_registry) { cr_registry->put(); } + delete binfo_cache; } /** @@ -3722,7 +3715,8 @@ int RGWRados::init_complete() } ldout(cct, 20) << __func__ << " bucket index max shards: " << bucket_index_max_shards << dendl; - binfo_cache.init(this); + binfo_cache = new RGWChainedCacheImpl; + binfo_cache->init(this); return ret; } @@ -10369,7 +10363,7 @@ int RGWRados::get_bucket_info(RGWObjectCtx& obj_ctx, string bucket_entry; rgw_make_bucket_entry_name(tenant, bucket_name, bucket_entry); - if (binfo_cache.find(bucket_entry, &e)) { + if (binfo_cache->find(bucket_entry, &e)) { info = e.info; if (pattrs) *pattrs = e.attrs; @@ -10439,7 +10433,7 @@ int RGWRados::get_bucket_info(RGWObjectCtx& obj_ctx, /* chain to both bucket entry point and bucket instance */ - if (!binfo_cache.put(this, bucket_entry, &e, cache_info_entries)) { + if (!binfo_cache->put(this, bucket_entry, &e, cache_info_entries)) { ldout(cct, 20) << "couldn't put binfo cache entry, might have raced with data changes" << dendl; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 1195aa331444c..6c6c60baeb78c 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1690,6 +1690,15 @@ struct RGWObjectCtx { class Finisher; class RGWAsyncRadosProcessor; +template +class RGWChainedCacheImpl; + +struct bucket_info_entry { + RGWBucketInfo info; + real_time mtime; + map attrs; +}; + class RGWRados { friend class RGWGC; @@ -1797,6 +1806,9 @@ protected: RWLock handle_lock; std::map rados_map; + using RGWChainedCacheImpl_bucket_info_entry = RGWChainedCacheImpl; + RGWChainedCacheImpl_bucket_info_entry *binfo_cache; + librados::IoCtx gc_pool_ctx; // .rgw.gc librados::IoCtx objexp_pool_ctx; @@ -1831,6 +1843,7 @@ public: max_bucket_id(0), cct(NULL), rados(NULL), next_rados_handle(0), num_rados_handles(0), handle_lock("rados_handle_lock"), + binfo_cache(NULL), pools_initialized(false), quota_handler(NULL), finisher(NULL), -- 2.39.5