diff options
author | Sage Weil <sage.weil@dreamhost.com> | 2012-02-10 06:54:34 +0100 |
---|---|---|
committer | Sage Weil <sage.weil@dreamhost.com> | 2012-02-10 07:05:57 +0100 |
commit | 7d85c4812937140e52efb1988cff34ad879f0cc3 (patch) | |
tree | 87b0936bc1a2dd4dd9c567d444865bbad11a1dc6 /src | |
parent | osd: new encoding for osd_stat_t (diff) | |
download | ceph-7d85c4812937140e52efb1988cff34ad879f0cc3.tar.xz ceph-7d85c4812937140e52efb1988cff34ad879f0cc3.zip |
osd: new encoding for pg_create_t
There was no version encoding previously, so this is an incompatible
change. Fortunately this type is only used in one place, MOSDPGCreate,
so we'll rev that encoding and compensate there. All is well!
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/messages/MOSDPGCreate.h | 19 | ||||
-rw-r--r-- | src/osd/osd_types.cc | 4 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/messages/MOSDPGCreate.h b/src/messages/MOSDPGCreate.h index 38410b99e1d..a9b3af74e42 100644 --- a/src/messages/MOSDPGCreate.h +++ b/src/messages/MOSDPGCreate.h @@ -38,13 +38,30 @@ public: const char *get_type_name() const { return "pg_create"; } void encode_payload(uint64_t features) { + header.version = 2; ::encode(epoch, payload); ::encode(mkpg, payload); } void decode_payload() { bufferlist::iterator p = payload.begin(); ::decode(epoch, p); - ::decode(mkpg, p); + if (header.version >= 2) { + ::decode(mkpg, p); + } else { + __u32 n; + ::decode(n, p); + while (n--) { + pg_t pgid; + epoch_t created; // epoch pg created + pg_t parent; // split from parent (if != pg_t()) + __s32 split_bits; + ::decode(pgid, p); + ::decode(created, p); + ::decode(parent, p); + ::decode(split_bits, p); + mkpg[pgid] = pg_create_t(created, parent, split_bits); + } + } } void print(ostream& out) const { diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index b79d865163b..5b4a10de4b8 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1609,16 +1609,20 @@ void pg_missing_t::got(const std::map<hobject_t, pg_missing_t::item>::iterator & void pg_create_t::encode(bufferlist &bl) const { + ENCODE_START(1, 1, bl); ::encode(created, bl); ::encode(parent, bl); ::encode(split_bits, bl); + ENCODE_FINISH(bl); } void pg_create_t::decode(bufferlist::iterator &bl) { + DECODE_START(1, bl); ::decode(created, bl); ::decode(parent, bl); ::decode(split_bits, bl); + DECODE_FINISH(bl); } void pg_create_t::dump(Formatter *f) const |