From ae7472fb075f7e1ea79598481786cba0d7e3f389 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Piotr=20Da=C5=82ek?= Date: Tue, 16 Jan 2018 10:28:58 +0100 Subject: [PATCH] osd_types.cc: reorder encoding/decoding of fields in pg_stat_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/osd/osd_types.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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); -- 2.39.5