From a809d48fc13de3d69c2bbb3245860a9c454ac199 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 16 Nov 2023 19:59:10 -0800 Subject: [PATCH] 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 --- src/crush/CrushCompiler.cc | 8 ++++---- src/crush/crush.h | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index 5e51aad8dba..f7df0c6670c 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 fde2df6a8a3..263922615b6 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 -- 2.39.5