]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: use get_parent_of_type
authorSage Weil <sage@redhat.com>
Tue, 2 May 2017 00:45:48 +0000 (19:45 -0500)
committerSage Weil <sage@redhat.com>
Tue, 2 May 2017 00:45:48 +0000 (19:45 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc

index d3a7cd4e0e0c8d4fc8d3e72c8148f84ffb071c7d..8fac5f50a7cae4888dc5c7475c9e73bcd50b21e8 100644 (file)
@@ -2239,15 +2239,7 @@ int CrushWrapper::_choose_type_stack(
       for (int pos = 0; pos < fanout; ++pos) {
        if (type > 0) {
          // non-leaf
-         int item = *tmpi;
-         do {
-           int r = get_immediate_parent_id(item, &item);
-           if (r < 0) {
-             ldout(cct, 10) << __func__ << " parent of " << item << " got "
-                            << cpp_strerror(r) << dendl;
-             return -EINVAL;
-           }
-         } while (get_bucket_type(item) != type);
+         int item = get_parent_of_type(*tmpi, type);
          o.push_back(item);
          ldout(cct, 10) << __func__ << "   from " << *tmpi << " got " << item
                         << " of type " << type << dendl;