]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: osd_types: add pool quota related fields
authorJoao Eduardo Luis <joao.luis@inktank.com>
Thu, 28 Mar 2013 19:24:51 +0000 (19:24 +0000)
committerSage Weil <sage@inktank.com>
Fri, 29 Mar 2013 23:03:21 +0000 (16:03 -0700)
src/osd/osd_types.cc
src/osd/osd_types.h

index 3fd134e31edce285dc7125e994a3442710ca9136..8410d83a7b1b5a2b7523dd260308265962a44813 100644 (file)
@@ -551,6 +551,8 @@ void pg_pool_t::dump(Formatter *f) const
   }
   f->close_section();
   f->dump_stream("removed_snaps") << removed_snaps;
+  f->dump_int("quota_max_bytes", quota_max_bytes);
+  f->dump_int("quota_max_objects", quota_max_objects);
 }
 
 
@@ -755,7 +757,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
     return;
   }
 
-  ENCODE_START(7, 5, bl);
+  ENCODE_START(8, 5, bl);
   ::encode(type, bl);
   ::encode(size, bl);
   ::encode(crush_ruleset, bl);
@@ -774,6 +776,8 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
   ::encode(flags, bl);
   ::encode(crash_replay_interval, bl);
   ::encode(min_size, bl);
+  ::encode(quota_max_bytes, bl);
+  ::encode(quota_max_objects, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -828,6 +832,10 @@ void pg_pool_t::decode(bufferlist::iterator& bl)
   } else {
     min_size = size - size/2;
   }
+  if (struct_v >= 8) {
+    ::decode(quota_max_bytes, bl);
+    ::decode(quota_max_objects, bl);
+  }
   DECODE_FINISH(bl);
   calc_pg_masks();
 }
@@ -848,6 +856,8 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
   a.snap_epoch = 11;
   a.auid = 12;
   a.crash_replay_interval = 13;
+  a.quota_max_bytes = 473;
+  a.quota_max_objects = 474;
   o.push_back(new pg_pool_t(a));
 
   a.snaps[3].name = "asdf";
@@ -859,6 +869,8 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o)
   o.push_back(new pg_pool_t(a));
 
   a.removed_snaps.insert(2);   // not quite valid to combine with snaps!
+  a.quota_max_bytes = 2473;
+  a.quota_max_objects = 4374;
   o.push_back(new pg_pool_t(a));
 }
 
@@ -877,6 +889,10 @@ ostream& operator<<(ostream& out, const pg_pool_t& p)
     out << " flags " << p.flags;
   if (p.crash_replay_interval)
     out << " crash_replay_interval " << p.crash_replay_interval;
+  if (p.quota_max_bytes)
+    out << " max_bytes " << p.quota_max_bytes;
+  if (p.quota_max_objects)
+    out << " max_objects " << p.quota_max_objects;
   return out;
 }
 
index d20e842859cd57e4d2b2d6d17f8bcc192d2eca25..dbed64ec5d1799edd917d5f21aa2ac07910d2829 100644 (file)
@@ -623,6 +623,7 @@ struct pg_pool_t {
   };
   enum {
     FLAG_HASHPSPOOL = 1, // hash pg seed and pool together (instead of adding)
+    FLAG_FULL       = 2, // pool is full
   };
 
   static const char *get_type_name(int t) {
@@ -650,6 +651,9 @@ public:
   uint64_t auid;            /// who owns the pg
   __u32 crash_replay_interval; /// seconds to allow clients to replay ACKed but unCOMMITted requests
 
+  uint64_t quota_max_bytes; /// maximum number of bytes for this pool
+  uint64_t quota_max_objects; /// maximum number of objects for this pool
+
   /*
    * Pool snaps (global to this pool).  These define a SnapContext for
    * the pool, unless the client manually specifies an alternate
@@ -674,6 +678,7 @@ public:
       snap_seq(0), snap_epoch(0),
       auid(0),
       crash_replay_interval(0),
+      quota_max_bytes(0), quota_max_objects(0),
       pg_num_mask(0), pgp_num_mask(0) { }
 
   void dump(Formatter *f) const;
@@ -714,6 +719,20 @@ public:
     calc_pg_masks();
   }
 
+  void set_quota_max_bytes(uint64_t m) {
+    quota_max_bytes = m;
+  }
+  uint64_t get_quota_max_bytes() {
+    return quota_max_bytes;
+  }
+
+  void set_quota_max_objects(uint64_t m) {
+    quota_max_objects = m;
+  }
+  uint64_t get_quota_max_objects() {
+    return quota_max_objects;
+  }
+
   static int calc_bits_of(int t);
   void calc_pg_masks();