crush: use is_shadow_item() wrapper if possible

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2017-07-26 19:59:19 +08:00
parent 1b87784f49
commit 4b898951c1

View File

@ -1308,8 +1308,7 @@ pair<string,string> CrushWrapper::get_immediate_parent(int id, int *_ret)
crush_bucket *b = crush->buckets[bidx];
if (b == 0)
continue;
const char *n = get_item_name(b->id);
if (n && !is_valid_crush_name(n))
if (is_shadow_item(b->id))
continue;
for (unsigned i = 0; i < b->size; i++)
if (b->items[i] == id) {
@ -1333,8 +1332,7 @@ int CrushWrapper::get_immediate_parent_id(int id, int *parent) const
crush_bucket *b = crush->buckets[bidx];
if (b == 0)
continue;
const char *n = get_item_name(b->id);
if (n && !is_valid_crush_name(n))
if (is_shadow_item(b->id))
continue;
for (unsigned i = 0; i < b->size; i++) {
if (b->items[i] == id) {