From 01d9e8a20bbc3c039f67b040da95018e2c7b00b6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 23 Nov 2016 13:48:35 -0500 Subject: [PATCH] osd/osd_types: conditional pg_pool_t encoding Align this with decode. Signed-off-by: Sage Weil --- src/osd/osd_types.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index b6fdc7fbe62..6e7e5a3d30a 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1488,7 +1488,8 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const return; } - ENCODE_START(24, 5, bl); + uint8_t v = 24; + ENCODE_START(v, 5, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -1530,13 +1531,25 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::encode(last_force_op_resend, bl); ::encode(min_read_recency_for_promote, bl); ::encode(expected_num_objects, bl); - ::encode(cache_target_dirty_high_ratio_micro, bl); - ::encode(min_write_recency_for_promote, bl); - ::encode(use_gmt_hitset, bl); - ::encode(fast_read, bl); - ::encode(hit_set_grade_decay_rate, bl); - ::encode(hit_set_search_last_n, bl); - ::encode(opts, bl); + if (v >= 19) { + ::encode(cache_target_dirty_high_ratio_micro, bl); + } + if (v >= 20) { + ::encode(min_write_recency_for_promote, bl); + } + if (v >= 21) { + ::encode(use_gmt_hitset, bl); + } + if (v >= 22) { + ::encode(fast_read, bl); + } + if (v >= 23) { + ::encode(hit_set_grade_decay_rate, bl); + ::encode(hit_set_search_last_n, bl); + } + if (v >= 24) { + ::encode(opts, bl); + } ENCODE_FINISH(bl); } -- 2.47.3