]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: binfo_cache is now a RGWRados member 8619/head
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 15 Apr 2016 17:25:12 +0000 (10:25 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 15 Apr 2016 17:44:50 +0000 (10:44 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 61c2b625d52b3d8ec37863d591ae0b52bd10f457..1623b973f9fcc08dd5d332f5f5787d5c05662394 100644 (file)
@@ -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<string, bufferlist> attrs;
-};
-
-static RGWChainedCacheImpl<bucket_info_entry> 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<bucket_info_entry>;
+  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;
   }
 
index 1195aa331444c8001f15380aebc3985b6abca7f8..6c6c60baeb78c91aab8784872d1cea5e94682dba 100644 (file)
@@ -1690,6 +1690,15 @@ struct RGWObjectCtx {
 class Finisher;
 class RGWAsyncRadosProcessor;
 
+template <class T>
+class RGWChainedCacheImpl;
+
+struct bucket_info_entry {
+  RGWBucketInfo info;
+  real_time mtime;
+  map<string, bufferlist> attrs;
+};
+
 class RGWRados
 {
   friend class RGWGC;
@@ -1797,6 +1806,9 @@ protected:
   RWLock handle_lock;
   std::map<pthread_t, int> rados_map;
 
+  using RGWChainedCacheImpl_bucket_info_entry = RGWChainedCacheImpl<bucket_info_entry>;
+  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),