]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add a new field 'expected_num_objects' to pg_pool_t which denotes the expected number...
authorGuang Yang <yguang@yahoo-inc.com>
Mon, 30 Jun 2014 05:42:49 +0000 (05:42 +0000)
committerGuang Yang <yguang@yahoo-inc.com>
Tue, 19 Aug 2014 07:08:51 +0000 (07:08 +0000)
Signed-off-by: Guang Yang (yguang@yahoo-inc.com)
src/osd/osd_types.cc
src/osd/osd_types.h

index 27f6e26c00ecc32ce3b43fde951b25f56a641474..1dc2af14e4c7d04f1af8214ab742872099765b65 100644 (file)
@@ -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<pg_pool_t*>& 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;
 }
 
index 4368998a1eddc485fbb704e5d8c3c0451703b155..deb30f480cbc7b130282efc748e630c9ed3b837d 100644 (file)
@@ -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;