From 1099ec23f0a2ca68a36211e5b125417500dc2aec Mon Sep 17 00:00:00 2001 From: Zhiqiang Wang Date: Thu, 18 Dec 2014 12:55:53 +0800 Subject: [PATCH] osd/osd_types: add min_write_recency_for_promote in pg_pool_t This field stands for the minimum number of hit sets to check before promote on write. Signed-off-by: Zhiqiang Wang --- src/osd/osd_types.cc | 14 ++++++++++++-- src/osd/osd_types.h | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 00b0b50b8e4db..b79956380a239 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -943,6 +943,7 @@ void pg_pool_t::dump(Formatter *f) const f->dump_unsigned("hit_set_period", hit_set_period); f->dump_unsigned("hit_set_count", hit_set_count); f->dump_unsigned("min_read_recency_for_promote", min_read_recency_for_promote); + f->dump_unsigned("min_write_recency_for_promote", min_write_recency_for_promote); f->dump_unsigned("stripe_width", get_stripe_width()); f->dump_unsigned("expected_num_objects", expected_num_objects); } @@ -1254,7 +1255,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const return; } - ENCODE_START(19, 5, bl); + ENCODE_START(20, 5, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -1297,12 +1298,13 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::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_FINISH(bl); } void pg_pool_t::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(19, 5, 5, bl); + DECODE_START_LEGACY_COMPAT_LEN(20, 5, 5, bl); ::decode(type, bl); ::decode(size, bl); ::decode(crush_ruleset, bl); @@ -1419,6 +1421,11 @@ void pg_pool_t::decode(bufferlist::iterator& bl) } else { cache_target_dirty_high_ratio_micro = cache_target_dirty_ratio_micro; } + if (struct_v >= 20) { + ::decode(min_write_recency_for_promote, bl); + } else { + min_write_recency_for_promote = 1; + } DECODE_FINISH(bl); calc_pg_masks(); } @@ -1465,6 +1472,7 @@ void pg_pool_t::generate_test_instances(list& o) a.hit_set_period = 3600; a.hit_set_count = 8; a.min_read_recency_for_promote = 1; + a.min_write_recency_for_promote = 1; a.set_stripe_width(12345); a.target_max_bytes = 1238132132; a.target_max_objects = 1232132; @@ -1521,6 +1529,8 @@ ostream& operator<<(ostream& out, const pg_pool_t& p) } if (p.min_read_recency_for_promote) out << " min_read_recency_for_promote " << p.min_read_recency_for_promote; + if (p.min_write_recency_for_promote) + out << " min_write_recency_for_promote " << p.min_write_recency_for_promote; out << " stripe_width " << p.get_stripe_width(); if (p.expected_num_objects) out << " expected_num_objects " << p.expected_num_objects; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 2e7f86ae56464..27ef70af2224b 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1101,7 +1101,8 @@ public: HitSet::Params hit_set_params; ///< The HitSet params to use on this pool uint32_t hit_set_period; ///< periodicity of HitSet segments (seconds) uint32_t hit_set_count; ///< number of periods to retain - uint32_t min_read_recency_for_promote; ///< minimum number of HitSet to check before promote + uint32_t min_read_recency_for_promote; ///< minimum number of HitSet to check before promote on read + uint32_t min_write_recency_for_promote; ///< minimum number of HitSet to check before promote on write uint32_t stripe_width; ///< erasure coded stripe size in bytes @@ -1131,6 +1132,7 @@ public: hit_set_period(0), hit_set_count(0), min_read_recency_for_promote(0), + min_write_recency_for_promote(0), stripe_width(0), expected_num_objects(0) { } -- 2.39.5