]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd_types.cc: don't store 32 least siognificant bits of state twice 19965/head
authorPiotr Dałek <piotr.dalek@corp.ovh.com>
Tue, 16 Jan 2018 09:47:19 +0000 (10:47 +0100)
committerPiotr Dałek <piotr.dalek@corp.ovh.com>
Tue, 16 Jan 2018 10:04:24 +0000 (11:04 +0100)
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 <piotr.dalek@corp.ovh.com>
src/osd/osd_types.cc

index 349b82a2b28ed16da6bb10c7de74e43b23046e1e..cf46ac67c8781f0c7189f19d504bd68ac338ce38 100644 (file)
@@ -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;