From: Loic Dachary Date: Wed, 5 Feb 2014 19:31:18 +0000 (+0100) Subject: mon: add erasure-code pg_pool_t::stripe_width X-Git-Tag: v0.78~221^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=11c11ba943ba14544af96ba138bf85565595f5f4;p=ceph.git mon: add erasure-code pg_pool_t::stripe_width Contains the actual stripe size used by erasure coded pools. It is initialized to zero by default and has to be explicitly set by erasure coded pools. get/set methods are added inline. Signed-off-by: Loic Dachary --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index c1ab20b03692..59a40d841338 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -756,6 +756,7 @@ void pg_pool_t::dump(Formatter *f) const f->close_section(); // hit_set_params f->dump_unsigned("hit_set_period", hit_set_period); f->dump_unsigned("hit_set_count", hit_set_count); + f->dump_unsigned("stripe_width", get_stripe_width()); } @@ -979,7 +980,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const } __u8 encode_compat = 5; - ENCODE_START(11, encode_compat, bl); + ENCODE_START(12, encode_compat, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -1012,12 +1013,13 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::encode(hit_set_params, bl); ::encode(hit_set_period, bl); ::encode(hit_set_count, bl); + ::encode(stripe_width, bl); ENCODE_FINISH_NEW_COMPAT(bl, encode_compat); } void pg_pool_t::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(11, 5, 5, bl); + DECODE_START_LEGACY_COMPAT_LEN(12, 5, 5, bl); ::decode(type, bl); ::decode(size, bl); ::decode(crush_ruleset, bl); @@ -1091,6 +1093,11 @@ void pg_pool_t::decode(bufferlist::iterator& bl) hit_set_period = def.hit_set_period; hit_set_count = def.hit_set_count; } + if (struct_v >= 12) { + ::decode(stripe_width, bl); + } else { + set_stripe_width(0); + } DECODE_FINISH(bl); calc_pg_masks(); } @@ -1137,6 +1144,7 @@ void pg_pool_t::generate_test_instances(list& o) a.hit_set_params = HitSet::Params(new BloomHitSet::Params); a.hit_set_period = 3600; a.hit_set_count = 8; + a.set_stripe_width(12345); o.push_back(new pg_pool_t(a)); } @@ -1174,6 +1182,7 @@ ostream& operator<<(ostream& out, const pg_pool_t& p) << " " << p.hit_set_period << "s" << " x" << p.hit_set_count; } + out << " stripe_width " << p.get_stripe_width(); return out; } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index e2a4822a2c49..d253dd2e49ad 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -831,6 +831,8 @@ public: uint32_t hit_set_period; ///< periodicity of HitSet segments (seconds) uint32_t hit_set_count; ///< number of periods to retain + uint32_t stripe_width; ///< erasure coded stripe size in bytes + pg_pool_t() : flags(0), type(0), size(0), min_size(0), crush_ruleset(0), object_hash(0), @@ -845,7 +847,8 @@ public: cache_mode(CACHEMODE_NONE), hit_set_params(), hit_set_period(0), - hit_set_count(0) + hit_set_count(0), + stripe_width(0) { } void dump(Formatter *f) const; @@ -874,6 +877,9 @@ public: void set_snap_seq(snapid_t s) { snap_seq = s; } void set_snap_epoch(epoch_t e) { snap_epoch = e; } + void set_stripe_width(uint32_t s) { stripe_width = s; } + uint32_t get_stripe_width() const { return stripe_width; } + bool is_replicated() const { return get_type() == TYPE_REPLICATED; } bool is_erasure() const { return get_type() == TYPE_ERASURE; }