From 0230fe673396cc84b595ff2215546880bd77eb5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Piotr=20Da=C5=82ek?= Date: Tue, 16 Jan 2018 10:47:19 +0100 Subject: [PATCH] osd_types.cc: don't store 32 least siognificant bits of state twice MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit a25221e55172c326b48dea6f08c16d700921864e introduced a new, 64bit pg state field, retaining encoding and decoding of least significant 32 bits for compatibility reasons. This commit also adds encoding of entire 64bit state field, meaning that the least significant bits are encoded and decoded twice. Fix this by encoding each half of 64bit field separately. Signed-off-by: Piotr Dałek --- src/osd/osd_types.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 349b82a2b28e..cf46ac67c878 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -2411,7 +2411,8 @@ void pg_stat_t::encode(bufferlist &bl) const encode(last_became_peered, bl); encode(pin_stats_invalid, bl); encode(snaptrimq_len, bl); - encode(state, bl); + __u32 top_state = (state >> 32); + encode(top_state, bl); encode(purged_snaps, bl); ENCODE_FINISH(bl); } @@ -2470,7 +2471,9 @@ void pg_stat_t::decode(bufferlist::iterator &bl) if (struct_v >= 23) { decode(snaptrimq_len, bl); if (struct_v >= 24) { - decode(state, bl); + __u32 top_state; + decode(top_state, bl); + state = (uint64_t)old_state | ((uint64_t)top_state << 32); decode(purged_snaps, bl); } else { state = old_state; -- 2.47.3