From: huangjun Date: Tue, 21 Jul 2015 06:42:33 +0000 (+0800) Subject: mon: added const to dump_* functions in PGMonitor X-Git-Tag: v9.1.0~236^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f9dd1ecd9392f5f31f12736d368393ce2feee58f;p=ceph.git mon: added const to dump_* functions in PGMonitor Signed-off-by: huangjun --- diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index a3eb9340df8e..3e2e0cd39f2a 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1258,7 +1258,7 @@ inline string percentify(const float& a) { //void PGMonitor::dump_object_stat_sum(stringstream& ss, Formatter *f, void PGMonitor::dump_object_stat_sum(TextTable &tbl, Formatter *f, object_stat_sum_t &sum, uint64_t avail, - bool verbose) + bool verbose) const { if (f) { f->dump_int("kb_used", SHIFT_ROUND_UP(sum.num_bytes, 10)); @@ -1289,7 +1289,7 @@ void PGMonitor::dump_object_stat_sum(TextTable &tbl, Formatter *f, } } -int64_t PGMonitor::get_rule_avail(OSDMap& osdmap, int ruleno) +int64_t PGMonitor::get_rule_avail(OSDMap& osdmap, int ruleno) const { map wm; int r = osdmap.crush->get_rule_weight_osd_map(ruleno, &wm); @@ -1412,7 +1412,7 @@ void PGMonitor::dump_pool_stats(stringstream &ss, Formatter *f, bool verbose) } } -void PGMonitor::dump_fs_stats(stringstream &ss, Formatter *f, bool verbose) +void PGMonitor::dump_fs_stats(stringstream &ss, Formatter *f, bool verbose) const { if (f) { f->open_object_section("stats"); @@ -1452,7 +1452,7 @@ void PGMonitor::dump_fs_stats(stringstream &ss, Formatter *f, bool verbose) } -void PGMonitor::dump_info(Formatter *f) +void PGMonitor::dump_info(Formatter *f) const { f->open_object_section("pgmap"); pg_map.dump(f); diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h index 7e1602522ee5..cb725a67a03c 100644 --- a/src/mon/PGMonitor.h +++ b/src/mon/PGMonitor.h @@ -148,9 +148,9 @@ private: void dump_object_stat_sum(TextTable &tbl, Formatter *f, object_stat_sum_t &sum, uint64_t avail, - bool verbose); + bool verbose) const; - int64_t get_rule_avail(OSDMap& osdmap, int ruleno); + int64_t get_rule_avail(OSDMap& osdmap, int ruleno) const; public: PGMonitor(Monitor *mn, Paxos *p, const string& service_name) @@ -190,9 +190,9 @@ public: void check_osd_map(epoch_t epoch); void dump_pool_stats(stringstream &ss, Formatter *f, bool verbose); - void dump_fs_stats(stringstream &ss, Formatter *f, bool verbose); + void dump_fs_stats(stringstream &ss, Formatter *f, bool verbose) const; - void dump_info(Formatter *f); + void dump_info(Formatter *f) const; int _warn_slow_request_histogram(const pow2_hist_t& h, string suffix, list >& summary, diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index c7f6cf919f93..acfea20fb6c5 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -869,7 +869,7 @@ public: * * @returns Our first committed version (that is available) */ - version_t get_first_committed() { + version_t get_first_committed() const{ return cached_first_committed; } /** @@ -877,7 +877,7 @@ public: * * @returns Our last committed version */ - version_t get_last_committed() { + version_t get_last_committed() const{ return cached_last_committed; }