From: Sage Weil Date: Thu, 13 Jul 2017 18:12:04 +0000 (-0400) Subject: crush/CrushWrapper: has_non_straw2_buckets() X-Git-Tag: v12.1.2~150^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f033d4a2706b757febba576ccfe86521fda386d;p=ceph.git crush/CrushWrapper: has_non_straw2_buckets() Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 2a1bf0051521..857d2d13dcf8 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -71,6 +71,18 @@ bool CrushWrapper::has_multirule_rulesets() const return false; } +bool CrushWrapper::has_non_straw2_buckets() const +{ + for (int i=0; imax_buckets; ++i) { + crush_bucket *b = crush->buckets[i]; + if (!b) + continue; + if (b->alg != CRUSH_BUCKET_STRAW2) + return true; + } + return false; +} + bool CrushWrapper::has_v2_rules() const { for (unsigned i=0; imax_rules; i++) { diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 5da29e44a53f..2a091bd90edf 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -117,6 +117,9 @@ public: /// true if any ruleset has more than 1 rule bool has_multirule_rulesets() const; + /// true if any buckets that aren't straw2 + bool has_non_straw2_buckets() const; + // tunables void set_tunables_argonaut() { crush->choose_local_tries = 2;