]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/rbd_mirror/ImageSyncThrottler.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / tools / rbd_mirror / ImageSyncThrottler.cc
index dfa96ed4d3e463f3a21faca658958aa54398e99f..c2e618bf48fc1110354ba26bb191144f693d83d5 100644 (file)
@@ -28,22 +28,23 @@ namespace rbd {
 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>
@@ -57,7 +58,7 @@ void ImageSyncThrottler<I>::start_op(const std::string &id, Context *on_start) {
       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 << "]"
@@ -202,10 +203,10 @@ const char** ImageSyncThrottler<I>::get_tracked_conf_keys() const {
 }
 
 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"));
   }
 }