From: Sage Weil Date: Tue, 9 Jul 2013 04:44:05 +0000 (-0700) Subject: mon/PaxosService: unwind should_trim() X-Git-Tag: v0.67-rc1~134^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=63fe8635ae56bdc20e8e4f83fa641c56f79805a3;p=ceph.git mon/PaxosService: unwind should_trim() Inline the single-caller helper. This will help us in a moment... Signed-off-by: Sage Weil --- diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 5c06f193271b..9f4a3f690cbe 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -323,31 +323,30 @@ void PaxosService::shutdown() void PaxosService::maybe_trim() { - if (is_writeable() && should_trim()) { - dout(10) << __func__ << " trimming" << dendl; - - MonitorDBStore::Transaction t; - encode_trim(&t); - bufferlist bl; - t.encode(bl); - - paxos->propose_new_value(bl, new C_Committed(this)); - } -} + if (!is_writeable()) + return; -bool PaxosService::should_trim() -{ update_trim(); if (get_trim_to() == 0) - return false; + return; if (g_conf->paxos_service_trim_min > 0) { version_t trim_to = get_trim_to(); version_t first = get_first_committed(); - if ((trim_to > 0) && trim_to > first) - return ((trim_to - first) >= (version_t)g_conf->paxos_service_trim_min); - } - return true; + if ((trim_to > 0) && + trim_to > first && + (trim_to - first) < (version_t)g_conf->paxos_service_trim_min) + return; // not enough to trim + } + + dout(10) << __func__ << " trimming" << dendl; + + MonitorDBStore::Transaction t; + encode_trim(&t); + bufferlist bl; + t.encode(bl); + + paxos->propose_new_value(bl, new C_Committed(this)); } void PaxosService::encode_trim(MonitorDBStore::Transaction *t) diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index cd00718a3671..ae15f049115d 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -686,11 +686,6 @@ public: */ virtual void encode_trim_extra(MonitorDBStore::Transaction *tx, version_t first) {} - /** - * decide whether we should trim service states - */ - bool should_trim(); - /** * Update our trim status. We do nothing here, because there is no * straightforward way to update the trim version, since that's service