]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: get_choose_args_positions helper
authorSage Weil <sage@redhat.com>
Fri, 14 Jul 2017 19:28:42 +0000 (15:28 -0400)
committerSage Weil <sage@redhat.com>
Fri, 21 Jul 2017 17:50:52 +0000 (13:50 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.h

index dc94519981c23454b5b10edd12ad26b76b8257d7..0835d79abdbfaca0e592c5ae3ecf8d8c00657090 100644 (file)
@@ -1452,6 +1452,16 @@ public:
     return choose_args_adjust_item_weight(cct, cmap, id, weight, ss);
   }
 
+  int get_choose_args_positions(crush_choose_arg_map cmap) {
+    // infer positions from other buckets
+    for (unsigned j = 0; j < cmap.size; ++j) {
+      if (cmap.args[j].weight_set_size) {
+       return cmap.args[j].weight_set_size;
+      }
+    }
+    return 1;
+  }
+
   template<typename WeightVector>
   void do_rule(int rule, int x, vector<int>& out, int maxout,
               const WeightVector& weight,