]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add erasure-code pg_pool_t::stripe_width
authorLoic Dachary <loic@dachary.org>
Wed, 5 Feb 2014 19:31:18 +0000 (20:31 +0100)
committerLoic Dachary <loic@dachary.org>
Wed, 5 Feb 2014 19:31:18 +0000 (20:31 +0100)
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 <loic@dachary.org>
src/osd/osd_types.cc
src/osd/osd_types.h

index c1ab20b0369239d7f5af5e283e2530a42232828b..59a40d841338dba662c28be2de4af57dd5611ed1 100644 (file)
@@ -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<pg_pool_t*>& 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;
 }
 
index e2a4822a2c497639ca835e9d487d65c539681148..d253dd2e49ad73ae4cbffa226a2d8033dca882e9 100644 (file)
@@ -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; }