mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
crush: clean up get_immediate_parent_id()
This is a follow-up cleanup of 9d908c14f6
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
0f23574234
commit
4736037394
@ -1327,19 +1327,14 @@ pair<string,string> CrushWrapper::get_immediate_parent(int id, int *_ret)
|
||||
return pair<string, string>();
|
||||
}
|
||||
|
||||
int CrushWrapper::get_immediate_parent_id(int id,
|
||||
int *parent,
|
||||
parent_type_t choice) const
|
||||
int CrushWrapper::get_immediate_parent_id(int id, int *parent) const
|
||||
{
|
||||
for (int bidx = 0; bidx < crush->max_buckets; bidx++) {
|
||||
crush_bucket *b = crush->buckets[bidx];
|
||||
if (b == 0)
|
||||
continue;
|
||||
if (choice == PARENT_NONSHADOW && is_shadow_item(b->id)) {
|
||||
if (is_shadow_item(b->id))
|
||||
continue;
|
||||
} else if (choice == PARENT_SHADOW && !is_shadow_item(b->id)) {
|
||||
continue;
|
||||
}
|
||||
for (unsigned i = 0; i < b->size; i++) {
|
||||
if (b->items[i] == id) {
|
||||
*parent = b->id;
|
||||
|
@ -662,15 +662,7 @@ public:
|
||||
*/
|
||||
pair<string,string> get_immediate_parent(int id, int *ret = NULL);
|
||||
|
||||
typedef enum {
|
||||
PARENT_NONSHADOW,
|
||||
PARENT_SHADOW,
|
||||
PARENT_ALL,
|
||||
} parent_type_t;
|
||||
|
||||
int get_immediate_parent_id(int id,
|
||||
int *parent,
|
||||
parent_type_t choice = PARENT_NONSHADOW) const;
|
||||
int get_immediate_parent_id(int id, int *parent) const;
|
||||
|
||||
/**
|
||||
* return ancestor of the given type, or 0 if none
|
||||
|
Loading…
Reference in New Issue
Block a user