From: Sage Weil Date: Sat, 2 Nov 2013 23:02:41 +0000 (-0700) Subject: osd, crush: add 'erasure' pool/pg type X-Git-Tag: v0.74~16^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9085286f88134fde57bbaa5cedb979cbd69179d2;p=ceph.git osd, crush: add 'erasure' pool/pg type Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index 5f92bf7e4ecd..4dc0c674ed54 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -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); diff --git a/src/crush/grammar.h b/src/crush/grammar.h index bb37fed428c8..e916421cb7e0 100644 --- a/src/crush/grammar.h +++ b/src/crush/grammar.h @@ -131,7 +131,7 @@ struct crush_grammar : public 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 diff --git a/src/include/rados.h b/src/include/rados.h index c410f8016720..eb65648d7c85 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -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. diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 351d050c476a..d90c60e7546f 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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; }