From: Guang Yang Date: Mon, 30 Jun 2014 05:42:49 +0000 (+0000) Subject: Add a new field 'expected_num_objects' to pg_pool_t which denotes the expected number... X-Git-Tag: v0.86~240^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=da37273de7aff2496c78dc63c3313a5307286591;p=ceph.git Add a new field 'expected_num_objects' to pg_pool_t which denotes the expected number of objects on this pool. Signed-off-by: Guang Yang (yguang@yahoo-inc.com) --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 27f6e26c00ec..1dc2af14e4c7 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -813,6 +813,7 @@ void pg_pool_t::dump(Formatter *f) const 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("stripe_width", get_stripe_width()); + f->dump_unsigned("expected_num_objects", expected_num_objects); } @@ -1112,7 +1113,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const return; } - ENCODE_START(16, 5, bl); + ENCODE_START(17, 5, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -1153,12 +1154,13 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::encode(erasure_code_profile, bl); ::encode(last_force_op_resend, bl); ::encode(min_read_recency_for_promote, bl); + ::encode(expected_num_objects, bl); ENCODE_FINISH(bl); } void pg_pool_t::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(16, 5, 5, bl); + DECODE_START_LEGACY_COMPAT_LEN(17, 5, 5, bl); ::decode(type, bl); ::decode(size, bl); ::decode(crush_ruleset, bl); @@ -1266,6 +1268,11 @@ void pg_pool_t::decode(bufferlist::iterator& bl) pg_pool_t def; min_read_recency_for_promote = def.min_read_recency_for_promote; } + if (struct_v >= 17) { + ::decode(expected_num_objects, bl); + } else { + expected_num_objects = 0; + } DECODE_FINISH(bl); calc_pg_masks(); } @@ -1320,6 +1327,7 @@ void pg_pool_t::generate_test_instances(list& o) a.cache_min_flush_age = 231; a.cache_min_evict_age = 2321; a.erasure_code_profile = "profile in osdmap"; + a.expected_num_objects = 123456; o.push_back(new pg_pool_t(a)); } @@ -1367,6 +1375,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; out << " stripe_width " << p.get_stripe_width(); + if (p.expected_num_objects) + out << " expected_num_objects " << p.expected_num_objects; return out; } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 4368998a1edd..deb30f480cbc 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -978,6 +978,9 @@ public: uint32_t stripe_width; ///< erasure coded stripe size in bytes + uint64_t expected_num_objects; ///< expected number of objects on this pool, a value of 0 indicates + ///< user does not specify any expected value + pg_pool_t() : flags(0), type(0), size(0), min_size(0), crush_ruleset(0), object_hash(0), @@ -1000,7 +1003,8 @@ public: hit_set_period(0), hit_set_count(0), min_read_recency_for_promote(0), - stripe_width(0) + stripe_width(0), + expected_num_objects(0) { } void dump(Formatter *f) const;