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 <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2017-06-14 17:44:14 +08:00
parent 2b4b718210
commit 61524b7a9e
3 changed files with 12 additions and 5 deletions

View File

@ -5961,6 +5961,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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);

View File

@ -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<entity_name_t, watch_info_t> 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);
}

View File

@ -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) {