From: Piotr Dałek Date: Tue, 16 Jan 2018 09:28:58 +0000 (+0100) Subject: osd_types.cc: reorder encoding/decoding of fields in pg_stat_t X-Git-Tag: wip-pdonnell-testing-20180317.202121~520^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ae7472fb075f7e1ea79598481786cba0d7e3f389;p=ceph-ci.git osd_types.cc: reorder encoding/decoding of fields in pg_stat_t Fields state, purged_snaps and snaptrimq_len are new to Mimic. Reorder them in a way that newest field (snaptrimq_len) is before two others and uses other encoding version, so the pull request https://github.com/ceph/ceph/pull/19520 can be backported to Luminous without breaking Luminous -> Mimic upgrade. This also changes encoding/decoding version back to 24 as both state and purged snaps were added post-Luminous and pre-Mimic, so we can push it into a single struct version and keep snaptrimq_len into other version. Signed-off-by: Piotr Dałek --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index c7246c498d5..349b82a2b28 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -2369,7 +2369,7 @@ void pg_stat_t::dump_brief(Formatter *f) const void pg_stat_t::encode(bufferlist &bl) const { - ENCODE_START(25, 22, bl); + ENCODE_START(24, 22, bl); encode(version, bl); encode(reported_seq, bl); encode(reported_epoch, bl); @@ -2410,9 +2410,9 @@ void pg_stat_t::encode(bufferlist &bl) const encode(last_peered, bl); encode(last_became_peered, bl); encode(pin_stats_invalid, bl); + encode(snaptrimq_len, bl); encode(state, bl); encode(purged_snaps, bl); - encode(snaptrimq_len, bl); ENCODE_FINISH(bl); } @@ -2468,14 +2468,12 @@ void pg_stat_t::decode(bufferlist::iterator &bl) decode(tmp, bl); pin_stats_invalid = tmp; if (struct_v >= 23) { - decode(state, bl); - } else { - state = old_state; - } - if (struct_v >= 24) { - decode(purged_snaps, bl); - if (struct_v >= 25) { - decode(snaptrimq_len, bl); + decode(snaptrimq_len, bl); + if (struct_v >= 24) { + decode(state, bl); + decode(purged_snaps, bl); + } else { + state = old_state; } } DECODE_FINISH(bl);