]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove unneeded RGWRados::num_rados_handles
authorCasey Bodley <cbodley@redhat.com>
Tue, 24 May 2016 14:23:26 +0000 (10:23 -0400)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 14 Jul 2016 08:06:28 +0000 (10:06 +0200)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 72d5a485e41ac5824c30556b6cfe659094cd303c)

src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index c1468309a9d65e4135dd545ea00aae7fb338686d..c7d8aa47f5c7d70b78a3f837dad7d7ec852a79b1 100644 (file)
@@ -3171,8 +3171,7 @@ void RGWRados::finalize()
 int RGWRados::init_rados()
 {
   int ret = 0;
-  auto count = cct->_conf->rgw_num_rados_handles;
-  auto handles = std::vector<librados::Rados>{count};
+  auto handles = std::vector<librados::Rados>{cct->_conf->rgw_num_rados_handles};
 
   for (auto& r : handles) {
     ret = r.init_with_context(cct);
@@ -3195,7 +3194,6 @@ int RGWRados::init_rados()
   meta_mgr = new RGWMetadataManager(cct, this);
   data_log = new RGWDataChangesLog(cct, this);
 
-  num_rados_handles = count;
   std::swap(handles, rados);
   return ret;
 }
@@ -12062,7 +12060,7 @@ void RGWStoreManager::close_storage(RGWRados *store)
 
 librados::Rados* RGWRados::get_rados_handle()
 {
-  if (num_rados_handles == 1) {
+  if (rados.size() == 1) {
     return &rados[0];
   } else {
     handle_lock.get_read();
@@ -12076,7 +12074,7 @@ librados::Rados* RGWRados::get_rados_handle()
       handle_lock.put_read();
       handle_lock.get_write();
       uint32_t handle = next_rados_handle.read();
-      if (handle == num_rados_handles) {
+      if (handle == rados.size()) {
         next_rados_handle.set(0);
         handle = 0;
       }
index 03dd1daf06ae369257a22b7b9dfb23f9c1ba5605..f5f8a7f64ce47e8274c376dcf68670cbaf8aad33 100644 (file)
@@ -1802,7 +1802,6 @@ protected:
 
   std::vector<librados::Rados> rados;
   atomic_t next_rados_handle;
-  uint32_t num_rados_handles;
   RWLock handle_lock;
   std::map<pthread_t, int> rados_map;
 
@@ -1842,7 +1841,7 @@ public:
                bucket_index_max_shards(0),
                max_bucket_id(0), cct(NULL),
                next_rados_handle(0),
-               num_rados_handles(0), handle_lock("rados_handle_lock"),
+               handle_lock("rados_handle_lock"),
                binfo_cache(NULL),
                pools_initialized(false),
                quota_handler(NULL),