mon/PaxosService: uninline should_trim()

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: reorder definitions

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: trim periodically instead of via propose_pending

We want to trim old states even if there is no update activity.  For
example, if a long-running rebalance finishes all osdmap updates will
stop and we won't trim out old maps to free space.

Instead, trim at the same time as tick().  Remove the trim during
propose_pending() to force all trims through this path and avoid
introducing a new and rarely-exercised behavior.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon/OSDMonitor: remove dup service_should_trim() implementation

This matches the parent.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/MDSMonitor: remove unnecessary service_should_trim()

We never set_trim_to(), so this is unnecessary.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: unwind service_should_trim() helper

Nobody overloads it; put it inline in should_trim().

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: unwind should_trim()

Inline the single-caller helper.  This will help us in a moment...

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: pass trim target into encode_trim()

This will help us in a few patches...

Signed-off-by: Sage Weil <sage@inktank.com>
mon: make service trim_to stateless

Call get_trim_to() when we need to know how much to trim (if any), and
calculate it then.  No need to keep this in a hidden trim_version
variable and remember to update it.  This drops several helpers and
accessors and makes get_trim_to() a single method that services need to
override.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: simplify paxos_service_trim_min check

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: move paxos_service_trim_max into caller, clean up

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: inline trim()

This is now trivial; pull it into the caller.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/PaxosService: update docs a bit

Signed-off-by: Sage Weil <sage@inktank.com>
Merge branch 'wip-mon-trim'

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>