From a243936f4cda9a9da3a00f57980a9d396ee84440 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 14 Jul 2017 15:28:42 -0400 Subject: [PATCH] crush/CrushWrapper: get_choose_args_positions helper Signed-off-by: Sage Weil --- src/crush/CrushWrapper.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index dc94519981c..0835d79abdb 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -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 void do_rule(int rule, int x, vector& out, int maxout, const WeightVector& weight, -- 2.39.5