From 79e4d248a7b4959a1312a2ca586f029a7cdfbfc9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 1 May 2017 19:45:48 -0500 Subject: [PATCH] crush/CrushWrapper: use get_parent_of_type Signed-off-by: Sage Weil --- src/crush/CrushWrapper.cc | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) 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; -- 2.47.3