From 31743d50a109a463d664ec9cf764d5405db507bd Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Thu, 12 Dec 2013 17:09:14 +0000 Subject: [PATCH] osd: OSDMap: add 'features' bit mask field to osd_xinfo_t And make sure we dump it on osd_xinfo_t::dump(). Signed-off-by: Joao Eduardo Luis --- src/osd/OSDMap.cc | 11 ++++++++++- src/osd/OSDMap.h | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index cbea920314c10..ec255dae78739 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -90,15 +90,20 @@ void osd_xinfo_t::dump(Formatter *f) const f->dump_stream("down_stamp") << down_stamp; f->dump_float("laggy_probability", laggy_probability); f->dump_int("laggy_interval", laggy_interval); + f->open_array_section("features"); + if (features & CEPH_FEATURE_OSD_ERASURE_CODES) + f->dump_string("flag", "erasure-codes"); + f->close_section(); } void osd_xinfo_t::encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); + ENCODE_START(2, 1, bl); ::encode(down_stamp, bl); __u32 lp = laggy_probability * 0xfffffffful; ::encode(lp, bl); ::encode(laggy_interval, bl); + ::encode(features, bl); ENCODE_FINISH(bl); } @@ -110,6 +115,10 @@ void osd_xinfo_t::decode(bufferlist::iterator& bl) ::decode(lp, bl); laggy_probability = (float)lp / (float)0xffffffff; ::decode(laggy_interval, bl); + if (struct_v >= 2) + ::decode(features, bl); + else + features = 0; DECODE_FINISH(bl); } diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index bd0b92ccecb36..a04507cecd42a 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -86,13 +86,14 @@ WRITE_CLASS_ENCODER(osd_info_t) ostream& operator<<(ostream& out, const osd_info_t& info); - struct osd_xinfo_t { utime_t down_stamp; ///< timestamp when we were last marked down float laggy_probability; ///< encoded as __u32: 0 = definitely not laggy, 0xffffffff definitely laggy __u32 laggy_interval; ///< average interval between being marked laggy and recovering + uint64_t features; ///< features supported by this osd we should know about - osd_xinfo_t() : laggy_probability(0), laggy_interval(0) {} + osd_xinfo_t() : laggy_probability(0), laggy_interval(0), + features(0) {} void dump(Formatter *f) const; void encode(bufferlist& bl) const; -- 2.39.5