From: Samuel Just Date: Fri, 17 Nov 2023 03:59:10 +0000 (-0800) Subject: src/crush: add a rule type enum X-Git-Tag: v19.3.0~57^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a809d48fc13de3d69c2bbb3245860a9c454ac199;p=ceph.git src/crush: add a rule type enum We're going to add more rule types that don't map directly onto pool types. Signed-off-by: Samuel Just --- diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index 5e51aad8dba4..f7df0c6670ce 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -363,10 +363,10 @@ int CrushCompiler::decompile(ostream &out) out << "\tid " << i << "\n"; switch (crush.get_rule_type(i)) { - case CEPH_PG_TYPE_REPLICATED: + case CRUSH_RULE_TYPE_REPLICATED: out << "\ttype replicated\n"; break; - case CEPH_PG_TYPE_ERASURE: + case CRUSH_RULE_TYPE_ERASURE: out << "\ttype erasure\n"; break; default: @@ -781,9 +781,9 @@ int CrushCompiler::parse_rule(iter_t const& i) string tname = string_node(i->children[start+2]); int type; if (tname == "replicated") - type = CEPH_PG_TYPE_REPLICATED; + type = CRUSH_RULE_TYPE_REPLICATED; else if (tname == "erasure") - type = CEPH_PG_TYPE_ERASURE; + type = CRUSH_RULE_TYPE_ERASURE; else ceph_abort(); diff --git a/src/crush/crush.h b/src/crush/crush.h index fde2df6a8a3e..263922615b63 100644 --- a/src/crush/crush.h +++ b/src/crush/crush.h @@ -87,7 +87,12 @@ struct crush_rule { #define crush_rule_size(len) (sizeof(struct crush_rule) + \ (len)*sizeof(struct crush_rule_step)) - +enum crush_rule_type { + CRUSH_RULE_TYPE_REPLICATED = 1, + CRUSH_RULE_TYPE_ERASURE = 3, + CRUSH_RULE_TYPE_MSR_FIRSTN = 4, + CRUSH_RULE_TYPE_MSR_INDEP = 5 +}; /* * A bucket is a named container of other items (either devices or