namespace mirror {
template <typename I>
-ImageSyncThrottler<I>::ImageSyncThrottler()
- : m_lock(librbd::util::unique_lock_name("rbd::mirror::ImageSyncThrottler",
+ImageSyncThrottler<I>::ImageSyncThrottler(CephContext *cct)
+ : m_cct(cct),
+ m_lock(librbd::util::unique_lock_name("rbd::mirror::ImageSyncThrottler",
this)),
- m_max_concurrent_syncs(g_ceph_context->_conf->get_val<uint64_t>(
+ m_max_concurrent_syncs(cct->_conf.get_val<uint64_t>(
"rbd_mirror_concurrent_image_syncs")) {
dout(20) << "max_concurrent_syncs=" << m_max_concurrent_syncs << dendl;
- g_ceph_context->_conf->add_observer(this);
+ m_cct->_conf.add_observer(this);
}
template <typename I>
ImageSyncThrottler<I>::~ImageSyncThrottler() {
- g_ceph_context->_conf->remove_observer(this);
+ m_cct->_conf.remove_observer(this);
Mutex::Locker locker(m_lock);
- assert(m_inflight_ops.empty());
- assert(m_queue.empty());
+ ceph_assert(m_inflight_ops.empty());
+ ceph_assert(m_queue.empty());
}
template <typename I>
dout(20) << "duplicate for already started op " << id << dendl;
} else if (m_max_concurrent_syncs == 0 ||
m_inflight_ops.size() < m_max_concurrent_syncs) {
- assert(m_queue.empty());
+ ceph_assert(m_queue.empty());
m_inflight_ops.insert(id);
dout(20) << "ready to start sync for " << id << " ["
<< m_inflight_ops.size() << "/" << m_max_concurrent_syncs << "]"
}
template <typename I>
-void ImageSyncThrottler<I>::handle_conf_change(const struct md_config_t *conf,
+void ImageSyncThrottler<I>::handle_conf_change(const ConfigProxy& conf,
const set<string> &changed) {
if (changed.count("rbd_mirror_concurrent_image_syncs")) {
- set_max_concurrent_syncs(conf->get_val<uint64_t>("rbd_mirror_concurrent_image_syncs"));
+ set_max_concurrent_syncs(conf.get_val<uint64_t>("rbd_mirror_concurrent_image_syncs"));
}
}