]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, crush: add 'erasure' pool/pg type
authorSage Weil <sage@inktank.com>
Sat, 2 Nov 2013 23:02:41 +0000 (16:02 -0700)
committerSage Weil <sage@inktank.com>
Tue, 3 Dec 2013 22:41:25 +0000 (14:41 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/crush/CrushCompiler.cc
src/crush/grammar.h
src/include/rados.h
src/osd/osd_types.h

index 5f92bf7e4ecd0f65258e98af67ebd93548c02a91..4dc0c674ed54de0f74c15a5a6b9d3e399eb68665 100644 (file)
@@ -233,6 +233,9 @@ int CrushCompiler::decompile(ostream &out)
     case CEPH_PG_TYPE_RAID4:
       out << "\ttype raid4\n";
       break;
+    case CEPH_PG_TYPE_ERASURE:
+      out << "\ttype erasure\n";
+      break;
     default:
       out << "\ttype " << crush.get_rule_mask_type(i) << "\n";
     }
@@ -562,8 +565,10 @@ int CrushCompiler::parse_rule(iter_t const& i)
   int type;
   if (tname == "replicated")
     type = CEPH_PG_TYPE_REP;
-  else if (tname == "raid4") 
+  else if (tname == "raid4")
     type = CEPH_PG_TYPE_RAID4;
+  else if (tname == "erasure")
+    type = CEPH_PG_TYPE_ERASURE;
   else 
     assert(0);    
 
index bb37fed428c85bff3e4781e334b9db1c9ebda646..e916421cb7e0ef7aa498589bdb34afeb0e4f4631 100644 (file)
@@ -131,7 +131,7 @@ struct crush_grammar : public grammar<crush_grammar>
                                step_emit );
       crushrule = str_p("rule") >> !name >> '{'
                           >> str_p("ruleset") >> posint
-                          >> str_p("type") >> ( str_p("replicated") | str_p("raid4") )
+                          >> str_p("type") >> ( str_p("replicated") | str_p("raid4") | str_p("erasure") )
                           >> str_p("min_size") >> posint
                           >> str_p("max_size") >> posint
                           >> +step
index c410f8016720141a34724c373384a893c83a2abf..eb65648d7c851a7488d184c9374968ea6366a75c 100644 (file)
@@ -64,9 +64,13 @@ struct ceph_pg {
 
 /*
  * pg pool types
+ *
+ * NOTE: These map 1:1 on to the pg_pool_t::TYPE_* values.  They are
+ * duplicated here only for CrushCompiler's benefit.
  */
 #define CEPH_PG_TYPE_REP     1
 #define CEPH_PG_TYPE_RAID4   2
+#define CEPH_PG_TYPE_ERASURE 3
 
 /*
  * stable_mod func is used to control number of placement groups.
index 351d050c476a6652c1cc4404a11a1ab407db4cfc..d90c60e7546fcfd2cee38e4b7c25c60ecce9efca 100644 (file)
@@ -688,11 +688,13 @@ struct pg_pool_t {
   enum {
     TYPE_REP = 1,     // replication
     TYPE_RAID4 = 2,   // raid4 (never implemented)
+    TYPE_ERASURE = 3,      // erasure-coded
   };
   static const char *get_type_name(int t) {
     switch (t) {
     case TYPE_REP: return "rep";
     case TYPE_RAID4: return "raid4";
+    case TYPE_ERASURE: return "erasure";
     default: return "???";
     }
   }
@@ -844,6 +846,7 @@ public:
 
   bool is_rep()   const { return get_type() == TYPE_REP; }
   bool is_raid4() const { return get_type() == TYPE_RAID4; }
+  bool is_erasure() const { return get_type() == TYPE_ERASURE; }
 
   unsigned get_pg_num() const { return pg_num; }
   unsigned get_pgp_num() const { return pgp_num; }