summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-01-30 00:50:33 -0800
committerSage Weil <sage@inktank.com>2013-02-05 14:31:13 -0800
commitb9bd482d7e2f1824af41ce40345cddf15423b9ce (patch)
treec98f1c77ecebf291b74f9ad563a27b58d833e8d3
parent43a01c9973c4b83f2eaa98be87429941a227ddde (diff)
downloadceph-b9bd482d7e2f1824af41ce40345cddf15423b9ce.tar.gz
crush: remove_rule() method
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/crush/CrushWrapper.cc13
-rw-r--r--src/crush/CrushWrapper.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc
index bae264245f7..bb60d5b3ca8 100644
--- a/src/crush/CrushWrapper.cc
+++ b/src/crush/CrushWrapper.cc
@@ -530,6 +530,19 @@ int CrushWrapper::add_simple_rule(string name, string root_name, string failure_
return rno;
}
+int CrushWrapper::remove_rule(int ruleno)
+{
+ if (ruleno >= (int)crush->max_rules)
+ return -ENOENT;
+ if (crush->rules[ruleno] == NULL)
+ return -ENOENT;
+ crush_destroy_rule(crush->rules[ruleno]);
+ crush->rules[ruleno] = NULL;
+ rule_name_map.erase(ruleno);
+ have_rmaps = false;
+ return 0;
+}
+
void CrushWrapper::encode(bufferlist& bl, bool lean) const
{
assert(crush);
diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h
index df2c620a82e..8bd43f0d925 100644
--- a/src/crush/CrushWrapper.h
+++ b/src/crush/CrushWrapper.h
@@ -532,6 +532,8 @@ public:
int add_simple_rule(string name, string root_name, string failure_domain_type);
+ int remove_rule(int ruleno);
+
/** buckets **/
private: