From 047379c2521434f2dbbe67ebbf53e59ed92654f0 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 24 May 2016 10:23:26 -0400 Subject: [PATCH] rgw: remove unneeded RGWRados::num_rados_handles Signed-off-by: Casey Bodley (cherry picked from commit 72d5a485e41ac5824c30556b6cfe659094cd303c) --- src/rgw/rgw_rados.cc | 8 +++----- src/rgw/rgw_rados.h | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index c1468309a9d65..c7d8aa47f5c7d 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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{count}; + auto handles = std::vector{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; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 03dd1daf06ae3..f5f8a7f64ce47 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1802,7 +1802,6 @@ protected: std::vector rados; atomic_t next_rados_handle; - uint32_t num_rados_handles; RWLock handle_lock; std::map 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), -- 2.39.5