From: John Spray Date: Mon, 27 Mar 2017 11:33:59 +0000 (+0100) Subject: mds: operator<< for Session X-Git-Tag: v12.0.2~46^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0f89787d8312f132ebb621f16c44e950b17a395a;p=ceph.git mds: operator<< for Session Use this to get a nice human readable name when available (also including the session id in parentheses) Signed-off-by: John Spray --- diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index 4dd73cd5472..a1ba0db4d80 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -1041,3 +1041,13 @@ bool SessionFilter::match( return true; } +std::ostream& operator<<(std::ostream &out, const Session &s) +{ + if (s.get_human_name() == stringify(s.info.inst.name.num())) { + out << s.get_human_name(); + } else { + out << s.get_human_name() << " (" << std::dec << s.info.inst.name.num() << ")"; + } + return out; +} + diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index f594a6c6709..f96d00ab275 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -666,5 +666,7 @@ public: MDSGatherBuilder *gather_bld); }; +std::ostream& operator<<(std::ostream &out, const Session &s); + #endif