]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/crush: add a rule type enum
authorSamuel Just <sjust@redhat.com>
Fri, 17 Nov 2023 03:59:10 +0000 (19:59 -0800)
committerSamuel Just <sjust@redhat.com>
Mon, 8 Jan 2024 18:50:16 +0000 (10:50 -0800)
We're going to add more rule types that don't map directly onto
pool types.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crush/CrushCompiler.cc
src/crush/crush.h

index 5e51aad8dba492cd61060547760ea7d76f87e1dc..f7df0c6670ce85de46bf4856cd823bbd3268367a 100644 (file)
@@ -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();
 
index fde2df6a8a3ec7cef8c59b253c9122eeea0a0b88..263922615b63844b1cfe0d5262b6375d63e112bb 100644 (file)
@@ -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