From: Jesse Williamson Date: Tue, 6 Dec 2016 22:04:55 +0000 (-0800) Subject: osd: Unifies heap command for OSD console and admin interface. X-Git-Tag: v12.0.2~120^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fc0949fe1acba112538c3ca24e3d3c381a7e5309;p=ceph.git osd: Unifies heap command for OSD console and admin interface. Signed-off-by: Jesse Williamson --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 05bee9f4893e..92d4e3a6a3cc 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1562,6 +1562,14 @@ void OSDService::queue_for_snap_trim(PG *pg) #undef dout_prefix #define dout_prefix *_dout +// Commands shared between OSD's console and admin console: +namespace ceph { +namespace osd_cmds { + +int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os); + +}} // namespace ceph::osd_cmds + int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev, uuid_d fsid, int whoami) { @@ -1988,7 +1996,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, } else if (command == "get_latest_osdmap") { get_latest_osdmap(); } else if (command == "heap") { - auto result = ceph::osd_cmds::admin::heap(*cct, cmdmap, *f, ss); + auto result = ceph::osd_cmds::heap(*cct, cmdmap, *f, ss); // Note: Failed heap profile commands won't necessarily trigger an error: f->open_object_section("result"); @@ -6024,17 +6032,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector& cmd, buffe } else if (prefix == "heap") { - if (!ceph_using_tcmalloc()) { - r = -EOPNOTSUPP; - ss << "could not issue heap profiler command -- not using tcmalloc!"; - } else { - string heapcmd; - cmd_getval(cct, cmdmap, "heapcmd", heapcmd); - // XXX 1-element vector, change at callee or make vector here? - vector heapcmd_vec; - get_str_vec(heapcmd, heapcmd_vec); - ceph_heap_profiler_handle_command(heapcmd_vec, ds); - } + r = ceph::osd_cmds::heap(*cct, cmdmap, *f, ds); } else if (prefix == "debug dump_missing") { @@ -9560,7 +9558,6 @@ void OSD::ShardedOpWQ::_enqueue_front(pair item) namespace ceph { namespace osd_cmds { -namespace admin { int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os) { @@ -9584,5 +9581,5 @@ int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os) return 0; } -}}} // namespace ceph::osd::admin_commands +}} // namespace ceph::osd_cmds diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 0076526a4bd2..7efcd376cb4a 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -2452,13 +2452,4 @@ extern const CompatSet::Feature ceph_osd_feature_compat[]; extern const CompatSet::Feature ceph_osd_feature_ro_compat[]; extern const CompatSet::Feature ceph_osd_feature_incompat[]; -namespace ceph { -namespace osd_cmds { -namespace admin { - -int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os); - -}}} // namespace ceph::osd_cmds::admin - - #endif