summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-01-19 22:06:27 -0800
committerSage Weil <sage@inktank.com>2013-01-22 14:47:38 -0800
commit101955a6b8bfdf91f4229f4ecb5d5b3da096e160 (patch)
tree6724bacfee114a6ece61b74a9f3e7ac17f4b1111
parent9230c863b3dc2bdda12c23202682a84c48f070a1 (diff)
downloadceph-101955a6b8bfdf91f4229f4ecb5d5b3da096e160.tar.gz
osd: make osd_max_backfills dynamically adjustable
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/common/AsyncReserver.h9
-rw-r--r--src/osd/OSD.cc5
2 files changed, 13 insertions, 1 deletions
diff --git a/src/common/AsyncReserver.h b/src/common/AsyncReserver.h
index 755d11a6753..8cc2258d7b4 100644
--- a/src/common/AsyncReserver.h
+++ b/src/common/AsyncReserver.h
@@ -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
*
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 4ffab8f1fab..3e319b64ea1 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -6219,6 +6219,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;
@@ -6227,6 +6228,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);
+ }
}
// --------------------------------