]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/osd_types: add min_write_recency_for_promote in pg_pool_t
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Thu, 18 Dec 2014 04:55:53 +0000 (12:55 +0800)
committerSamuel Just <sjust@redhat.com>
Tue, 18 Aug 2015 18:25:21 +0000 (11:25 -0700)
This field stands for the minimum number of hit sets to check before
promote on write.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/osd/osd_types.cc
src/osd/osd_types.h

index 00b0b50b8e4db0cf0f070be93813180cf0603fc0..b79956380a2396c222df357123192391cb2dd1f3 100644 (file)
@@ -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<pg_pool_t*>& 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;
index 2e7f86ae5646476fa2b9b60e698706b7b538c3ce..27ef70af2224b95fa63c9e03b5995bb2e19cdfa5 100644 (file)
@@ -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)
   { }