From 8f033d4a2706b757febba576ccfe86521fda386d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 13 Jul 2017 14:12:04 -0400 Subject: [PATCH] crush/CrushWrapper: has_non_straw2_buckets() Signed-off-by: Sage Weil --- src/crush/CrushWrapper.cc | 12 ++++++++++++ src/crush/CrushWrapper.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 2a1bf00515211..857d2d13dcf89 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 5da29e44a53f5..2a091bd90edf0 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; -- 2.39.5