Skip to content

Commit

Permalink
crush/CrushWrapper: rule_has_take
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Sep 6, 2017
1 parent 60b9cfa commit ef140de
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/crush/CrushWrapper.h
Expand Up @@ -976,6 +976,17 @@ class CrushWrapper {
return true;
return false;
}
bool rule_has_take(unsigned ruleno, int take) const {
if (!crush) return false;
crush_rule *rule = get_rule(ruleno);
for (unsigned i = 0; i < rule->len; ++i) {
if (rule->steps[i].op == CRUSH_RULE_TAKE &&
rule->steps[i].arg1 == take) {
return true;
}
}
return false;
}
int get_rule_len(unsigned ruleno) const {
crush_rule *r = get_rule(ruleno);
if (IS_ERR(r)) return PTR_ERR(r);
Expand Down

0 comments on commit ef140de

Please sign in to comment.