From: Sage Weil Date: Wed, 30 Jan 2013 08:50:33 +0000 (-0800) Subject: crush: remove_rule() method X-Git-Tag: v0.58~141^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9bd482d7e2f1824af41ce40345cddf15423b9ce;p=ceph.git crush: remove_rule() method Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index bae264245f7b..bb60d5b3ca81 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 df2c620a82e6..8bd43f0d9251 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: