From: Sage Weil Date: Tue, 2 May 2017 00:45:48 +0000 (-0500) Subject: crush/CrushWrapper: use get_parent_of_type X-Git-Tag: v12.1.0~10^2~91^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=79e4d248a7b4959a1312a2ca586f029a7cdfbfc9;p=ceph.git crush/CrushWrapper: use get_parent_of_type Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index d3a7cd4e0e0c..8fac5f50a7ca 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -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;