]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: add choosemsr rule
authorSamuel Just <sjust@redhat.com>
Mon, 18 Dec 2023 20:58:15 +0000 (12:58 -0800)
committerSamuel Just <sjust@redhat.com>
Thu, 1 Feb 2024 20:01:52 +0000 (12:01 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crush/CrushWrapper.h
src/crush/crush.h
src/crush/grammar.h

index 4425103ff6f26347fc7461e4db87ae24c406686d..f71f6d6ea79b6b942ef9996ea8dfe7ef9400b3bd 100644 (file)
@@ -1208,6 +1208,9 @@ public:
   int set_rule_step_choose_leaf_indep(unsigned ruleno, unsigned step, int val, int type) {
     return set_rule_step(ruleno, step, CRUSH_RULE_CHOOSELEAF_INDEP, val, type);
   }
+  int set_rule_step_choose_msr(unsigned ruleno, unsigned step, int val, int type) {
+    return set_rule_step(ruleno, step, CRUSH_RULE_CHOOSE_MSR, val, type);
+  }
   int set_rule_step_emit(unsigned ruleno, unsigned step) {
     return set_rule_step(ruleno, step, CRUSH_RULE_EMIT, 0, 0);
   }
index a2ec2e1de69fb43324745168408fd9e2b3cea1a9..7c6ce7fdf453a262db42bfaa09fe404d69bf16d6 100644 (file)
@@ -69,6 +69,9 @@ enum crush_opcodes {
 
        CRUSH_RULE_SET_MSR_DESCENTS = 14,
        CRUSH_RULE_SET_MSR_COLLISION_TRIES = 15,
+
+       /* choose variant without FIRSTN|INDEP */
+       CRUSH_RULE_CHOOSE_MSR = 16
 };
 
 /*
index 9e955091c6a88966a73075cc444fc64de6535db6..0c9a2da7d77069ea2577e0388c76cffa4def0001 100644 (file)
@@ -54,6 +54,7 @@ struct crush_grammar : public boost::spirit::grammar<crush_grammar>
     _step_set_msr_collision_tries,
     _step_choose,
     _step_chooseleaf,
+    _step_choose_msr,
     _step_emit,
     _step,
     _crushrule,
@@ -97,6 +98,7 @@ struct crush_grammar : public boost::spirit::grammar<crush_grammar>
     boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_step_set_msr_collision_tries> >    step_set_msr_collision_tries;
     boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_step_choose> >    step_choose;
     boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_step_chooseleaf> >      step_chooseleaf;
+    boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_step_choose_msr> >      step_choose_msr;
     boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_step_emit> >      step_emit;
     boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_step> >      step;
     boost::spirit::rule<ScannerT, boost::spirit::parser_context<>, boost::spirit::parser_tag<_crushrule> >      crushrule;
@@ -163,6 +165,9 @@ struct crush_grammar : public boost::spirit::grammar<crush_grammar>
        >> ( str_p("indep") | str_p("firstn") )
        >> integer
        >> str_p("type") >> name;
+      step_choose_msr = str_p("choosemsr")
+       >> integer
+       >> str_p("type") >> name;
       step_emit = str_p("emit");
       step = str_p("step") >> ( step_take |
                                step_set_choose_tries |
@@ -175,6 +180,7 @@ struct crush_grammar : public boost::spirit::grammar<crush_grammar>
                                step_set_msr_collision_tries |
                                step_choose |
                                step_chooseleaf |
+                               step_choose_msr |
                                step_emit );
       crushrule = str_p("rule") >> !name >> '{'
                                >> (str_p("id") | str_p("ruleset")) >> posint