diff options
author | Sage Weil <sage@inktank.com> | 2013-07-04 14:57:06 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-05 10:06:50 -0700 |
commit | c5812b1c893305a7d20f9eaec2695c8b1691f0c9 (patch) | |
tree | 5bdaa2d5e8fed287e147936067c888175da989b0 | |
parent | 6fbcbd7fddf35a5be4b38e536871903bff4f9bf1 (diff) | |
download | ceph-c5812b1c893305a7d20f9eaec2695c8b1691f0c9.tar.gz |
mon: uninline _trim_enable and Paxos::trim_{enable,disable} so we can debug them
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/mon/Monitor.cc | 16 | ||||
-rw-r--r-- | src/mon/Monitor.h | 11 | ||||
-rw-r--r-- | src/mon/Paxos.cc | 11 | ||||
-rw-r--r-- | src/mon/Paxos.h | 5 |
4 files changed, 30 insertions, 13 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index e541d4b77a1..bb328325f10 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1033,6 +1033,22 @@ void Monitor::sync_finish(entity_inst_t &entity, bool abort) finish_contexts(g_ceph_context, maybe_wait_for_quorum); } +void Monitor::_trim_enable() +{ + Mutex::Locker l(trim_lock); + // even if we are no longer the leader, we should re-enable trim if + // we have disabled it in the past. It doesn't mean we are going to + // do anything about it, but if we happen to become the leader + // sometime down the future, we sure want to have the trim enabled. + if (trim_timeouts.empty()) { + dout(10) << __func__ << " enabling" << dendl; + paxos->trim_enable(); + } else { + dout(10) << __func__ << " NOT enabling" << dendl; + } + trim_enable_timer = NULL; +} + void Monitor::handle_sync_finish(MMonSync *m) { dout(10) << __func__ << " " << *m << dendl; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 9e31bebd6d9..e6bdc8f2af4 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -350,17 +350,12 @@ private: C_TrimEnable(Monitor *m) : mon(m) { } void finish(int r) { - Mutex::Locker(mon->trim_lock); - // even if we are no longer the leader, we should re-enable trim if - // we have disabled it in the past. It doesn't mean we are going to - // do anything about it, but if we happen to become the leader - // sometime down the future, we sure want to have the trim enabled. - if (mon->trim_timeouts.empty()) - mon->paxos->trim_enable(); - mon->trim_enable_timer = NULL; + mon->_trim_enable(); } }; + void _trim_enable(); + void sync_obtain_latest_monmap(bufferlist &bl); void sync_store_init(); void sync_store_cleanup(); diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 1b43da95546..01e06209872 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -1005,7 +1005,16 @@ void Paxos::trim_to(version_t first) } } -void Paxos::trim_enable() { +void Paxos::trim_disable() +{ + dout(10) << __func__ << dendl; + if (!trim_disabled_version) + trim_disabled_version = get_version(); +} + +void Paxos::trim_enable() +{ + dout(10) << __func__ << dendl; trim_disabled_version = 0; // We may not be the leader when we reach this function. We sure must // have been the leader at some point, but we may have been demoted and diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index eeb1f34f198..b7cfe6cea0a 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -1161,10 +1161,7 @@ public: * This is required by the Monitor's store synchronization mechanisms * to guarantee a consistent store state. */ - void trim_disable() { - if (!trim_disabled_version) - trim_disabled_version = get_version(); - } + void trim_disable(); /** * Enable trimming */ |