]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make osd_max_backfills dynamically adjustable
authorSage Weil <sage@inktank.com>
Sun, 20 Jan 2013 06:06:27 +0000 (22:06 -0800)
committerSamuel Just <sam.just@inktank.com>
Sat, 26 Jan 2013 01:14:58 +0000 (17:14 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 101955a6b8bfdf91f4229f4ecb5d5b3da096e160)

src/common/AsyncReserver.h
src/osd/OSD.cc

index 755d11a67532e20d17cab6e114ccf4c54aaca010..8cc2258d7b47382d4b03f1c78aedd9deee710280 100644 (file)
@@ -28,7 +28,7 @@
 template <typename T>
 class AsyncReserver {
   Finisher *f;
-  const unsigned max_allowed;
+  unsigned max_allowed;
   Mutex lock;
 
   list<pair<T, Context*> > queue;
@@ -51,6 +51,13 @@ public:
     unsigned max_allowed)
     : f(f), max_allowed(max_allowed), lock("AsyncReserver::lock") {}
 
+  void set_max(unsigned max) {
+    Mutex::Locker l(lock);
+    assert(max > 0);
+    max_allowed = max;
+    do_queues();
+  }
+
   /**
    * Requests a reservation
    *
index ba8ac57fe6df5d3af2db23e67becc777fc4801f7..ec31b22d0367c2b1267176859fb45e0f3c830c95 100644 (file)
@@ -6215,6 +6215,7 @@ void OSD::process_peering_events(const list<PG*> &pgs)
 const char** OSD::get_tracked_conf_keys() const
 {
   static const char* KEYS[] = {
+    "osd_max_backfills",
     NULL
   };
   return KEYS;
@@ -6223,6 +6224,10 @@ const char** OSD::get_tracked_conf_keys() const
 void OSD::handle_conf_change(const struct md_config_t *conf,
                             const std::set <std::string> &changed)
 {
+  if (changed.count("osd_max_backfills")) {
+    service.local_reserver.set_max(g_conf->osd_max_backfills);
+    service.remote_reserver.set_max(g_conf->osd_max_backfills);
+  }
 }
 
 // --------------------------------