]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: set min_size to data chunk count for erasure pools
authorSage Weil <sage@inktank.com>
Wed, 28 May 2014 20:59:47 +0000 (13:59 -0700)
committerSage Weil <sage@redhat.com>
Sat, 2 Aug 2014 00:45:03 +0000 (17:45 -0700)
Make the min_size value meaningful for erasure pools.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit e06c58c9b8f585d2fe7c97d010aa0aa61c09d609)

src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index ed2cf3799b5bd67c620fb6ba9240ca5a5b2354f8..a407f671b3a5feb88160be042f334cdbb2ac9682 100644 (file)
@@ -3146,20 +3146,23 @@ int OSDMonitor::parse_erasure_code_profile(const vector<string> &erasure_code_pr
 
 int OSDMonitor::prepare_pool_size(const unsigned pool_type,
                                  const string &erasure_code_profile,
-                                 unsigned *size,
+                                 unsigned *size, unsigned *min_size,
                                  stringstream &ss)
 {
   int err = 0;
   switch (pool_type) {
   case pg_pool_t::TYPE_REPLICATED:
     *size = g_conf->osd_pool_default_size;
+    *min_size = g_conf->get_osd_pool_default_min_size();
     break;
   case pg_pool_t::TYPE_ERASURE:
     {
       ErasureCodeInterfaceRef erasure_code;
       err = get_erasure_code(erasure_code_profile, &erasure_code, ss);
-      if (err == 0)
+      if (err == 0) {
        *size = erasure_code->get_chunk_count();
+       *min_size = erasure_code->get_data_chunk_count();
+      }
     }
     break;
   default:
@@ -3276,8 +3279,8 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid,
                                 crush_ruleset_name, &crush_ruleset, ss);
   if (r)
     return r;
-  unsigned size;
-  r = prepare_pool_size(pool_type, erasure_code_profile, &size, ss);
+  unsigned size, min_size;
+  r = prepare_pool_size(pool_type, erasure_code_profile, &size, &min_size, ss);
   if (r)
     return r;
   uint32_t stripe_width = 0;
@@ -3303,7 +3306,7 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid,
     pi->flags |= pg_pool_t::FLAG_HASHPSPOOL;
 
   pi->size = size;
-  pi->min_size = g_conf->get_osd_pool_default_min_size();
+  pi->min_size = min_size;
   pi->crush_ruleset = crush_ruleset;
   pi->object_hash = CEPH_STR_HASH_RJENKINS;
   pi->set_pg_num(pg_num ? pg_num : g_conf->osd_pool_default_pg_num);
index 2d4f3795f418e85a9e811e63b8666314e8c5a3d1..fbce5fecd182d9c94b50fdc6dd6cd5007fa90ac2 100644 (file)
@@ -272,7 +272,7 @@ private:
                                 stringstream &ss);
   int prepare_pool_size(const unsigned pool_type,
                        const string &erasure_code_profile,
-                       unsigned *size,
+                       unsigned *size, unsigned *min_size,
                        stringstream &ss);
   int prepare_pool_stripe_width(const unsigned pool_type,
                                const string &erasure_code_profile,