From ef5cd825df21a441ef28fb8ae3d74dc0b3b8a19b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 28 Aug 2017 17:08:47 -0400 Subject: [PATCH] mon/PGMap: streamline encoding The only user left is 'pg getmap' and ceph-dencoder; we can drop the compat cruft. Signed-off-by: Sage Weil --- src/mon/PGMap.cc | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 81d7fdf6807da..c0a963a072752 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -1334,54 +1334,25 @@ void PGMap::encode_digest(const OSDMap& osdmap, void PGMap::encode(bufferlist &bl, uint64_t features) const { - assert(features & CEPH_FEATURE_MONENC); - ENCODE_START(6, 4, bl); + ENCODE_START(7, 7, bl); ::encode(version, bl); ::encode(pg_stat, bl); ::encode(osd_stat, bl); ::encode(last_osdmap_epoch, bl); ::encode(last_pg_scan, bl); - ::encode((float).95, bl); - ::encode((float).85, bl); ::encode(stamp, bl); - { - map osd_epochs; - ::encode(osd_epochs, bl); - } ENCODE_FINISH(bl); } void PGMap::decode(bufferlist::iterator &bl) { - DECODE_START_LEGACY_COMPAT_LEN(6, 4, 4, bl); + DECODE_START(7, bl); ::decode(version, bl); - if (struct_v < 3) { - pg_stat.clear(); - __u32 n; - ::decode(n, bl); - while (n--) { - old_pg_t opgid; - ::decode(opgid, bl); - pg_t pgid = opgid; - ::decode(pg_stat[pgid], bl); - } - } else { - ::decode(pg_stat, bl); - } + ::decode(pg_stat, bl); ::decode(osd_stat, bl); ::decode(last_osdmap_epoch, bl); ::decode(last_pg_scan, bl); - if (struct_v >= 2) { - float full_ratio; - ::decode(full_ratio, bl); - ::decode(full_ratio, bl); // nearfull - } - if (struct_v >= 5) - ::decode(stamp, bl); - if (struct_v >= 6) { - map osd_epochs; - ::decode(osd_epochs, bl); - } + ::decode(stamp, bl); DECODE_FINISH(bl); calc_stats(); -- 2.39.5