From: Samuel Just Date: Wed, 9 Jan 2013 19:56:16 +0000 (-0800) Subject: osd_types: bring ScrubMap::object up to the 0.56.1 encoding X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f969f6b39727a2135e39729d61960d8efda2be39;p=ceph.git osd_types: bring ScrubMap::object up to the 0.56.1 encoding We need to introduce some new fields here, so to maintain compatibility we'll need to first bring the 48.* series up to the current encoding. Signed-off-by: Samuel Just --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index c939270f7180..74975a917589 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -2508,19 +2508,29 @@ void ScrubMap::generate_test_instances(list& o) void ScrubMap::object::encode(bufferlist& bl) const { - ENCODE_START(2, 2, bl); + ENCODE_START(3, 2, bl); ::encode(size, bl); ::encode(negative, bl); ::encode(attrs, bl); + ::encode(digest, bl); + ::encode(digest_present, bl); ENCODE_FINISH(bl); } void ScrubMap::object::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); + DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); ::decode(size, bl); ::decode(negative, bl); ::decode(attrs, bl); + if (struct_v >= 3) { + ::decode(digest, bl); + ::decode(digest_present, bl); + } + else { + digest = 0; + digest_present = false; + } DECODE_FINISH(bl); } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index e2ca0e045151..b2a41a175a71 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1749,8 +1749,10 @@ struct ScrubMap { uint64_t size; bool negative; map attrs; + __u32 digest; + bool digest_present; - object(): size(0), negative(false) {} + object(): size(0), negative(false), digest(0), digest_present(false) {} void encode(bufferlist& bl) const; void decode(bufferlist::iterator& bl);