]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crush: assume weight_set != null imples weight_set_size > 0
authorSage Weil <sage@redhat.com>
Fri, 21 Jul 2017 19:18:10 +0000 (15:18 -0400)
committerSage Weil <sage@redhat.com>
Fri, 21 Jul 2017 19:18:10 +0000 (15:18 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.h
src/crush/mapper.c

index 251357335fb18003db539bc88487ca27079b55b8..ec6a9ea85816f1797e34daa96457b8af693dfb4f 100644 (file)
@@ -1329,6 +1329,7 @@ public:
   void create_choose_args(int id, int positions) {
     if (choose_args.count(id))
       return;
+    assert(positions);
     auto &cmap = choose_args[id];
     cmap.args = (crush_choose_arg*)calloc(sizeof(crush_choose_arg),
                                          crush->max_buckets);
index 8ea91897dfa412cf1518e66c0dbce9f9fac3584a..e15039ed944b9b880647e73d8cafd38d9f6c4a46 100644 (file)
@@ -304,8 +304,7 @@ static inline __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bu
                                             int position)
 {
   if ((arg == NULL) ||
-      (arg->weight_set == NULL) ||
-      (arg->weight_set_size == 0))
+      (arg->weight_set == NULL))
     return bucket->item_weights;
   if (position >= arg->weight_set_size)
     position = arg->weight_set_size - 1;