From 61524b7a9e56ff43c4bae29966fdebb12b79adff Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 14 Jun 2017 17:44:14 +0800 Subject: [PATCH] osd/OSD: bump up current version of encoding; conditionally encoding manifest into oi These versions shall match the corresponding encoding versions. Signed-off-by: xie xingguo --- src/osd/PrimaryLogPG.cc | 1 + src/osd/osd_types.cc | 12 ++++++++---- src/osd/osd_types.h | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index bb578d8447b..9daa478d2d2 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5961,6 +5961,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) result = -EINVAL; break; } + oi.set_flag(object_info_t::FLAG_MANIFEST); oi.manifest.redirect_target = target; oi.manifest.type = object_manifest_t::TYPE_REDIRECT; t->truncate(soid, 0); diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index dcfe790567f..e2846c65da7 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1581,7 +1581,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const void pg_pool_t::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(24, 5, 5, bl); + DECODE_START_LEGACY_COMPAT_LEN(25, 5, 5, bl); ::decode(type, bl); ::decode(size, bl); ::decode(crush_ruleset, bl); @@ -5057,14 +5057,16 @@ void object_info_t::encode(bufferlist& bl, uint64_t features) const ::encode(expected_object_size, bl); ::encode(expected_write_size, bl); ::encode(alloc_hint_flags, bl); - ::encode(manifest, bl); + if (has_manifest()) { + ::encode(manifest, bl); + } ENCODE_FINISH(bl); } void object_info_t::decode(bufferlist::iterator& bl) { object_locator_t myoloc; - DECODE_START_LEGACY_COMPAT_LEN(16, 8, 8, bl); + DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl); map old_watchers; ::decode(soid, bl); ::decode(myoloc, bl); @@ -5147,7 +5149,9 @@ void object_info_t::decode(bufferlist::iterator& bl) alloc_hint_flags = 0; } if (struct_v >= 17) { - ::decode(manifest, bl); + if (has_manifest()) { + ::decode(manifest, bl); + } } DECODE_FINISH(bl); } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 3e2128e414e..124e40c82aa 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -4508,6 +4508,8 @@ struct object_info_t { s += "|omap_digest"; if (flags & FLAG_CACHE_PIN) s += "|cache_pin"; + if (flags & FLAG_MANIFEST) + s += "|manifest"; if (s.length()) return s.substr(1); return s; @@ -4569,7 +4571,7 @@ struct object_info_t { return test_flag(FLAG_CACHE_PIN); } bool has_manifest() const { - return !manifest.is_empty(); + return test_flag(FLAG_MANIFEST); } void set_data_digest(__u32 d) { -- 2.39.5