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);
meta_mgr = new RGWMetadataManager(cct, this);
data_log = new RGWDataChangesLog(cct, this);
- num_rados_handles = count;
std::swap(handles, rados);
return ret;
}
librados::Rados* RGWRados::get_rados_handle()
{
- if (num_rados_handles == 1) {
+ if (rados.size() == 1) {
return &rados[0];
} else {
handle_lock.get_read();
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;
}
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;
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),