Lines Matching refs:cur_layer

171     struct idr_layer *cur_layer = idp->top;  in __idr_get_empty_slot()  local
174 stk[layer] = cur_layer; in __idr_get_empty_slot()
175 int pos = __lowbit_id(~cur_layer->full); in __idr_get_empty_slot()
184 cur_layer = cur_layer->ary[pos]; in __idr_get_empty_slot()
186 if (layer > 0 && NULL == cur_layer) // 只有非叶子节点才需要开辟儿子节点 in __idr_get_empty_slot()
189 cur_layer = __get_from_free_list(idp); in __idr_get_empty_slot()
190 if (NULL == cur_layer) in __idr_get_empty_slot()
192 cur_layer->layer = layer - 1; // 儿子节点的layer in __idr_get_empty_slot()
193 cur_layer->full = 0; in __idr_get_empty_slot()
194 cur_layer->bitmap = 0; in __idr_get_empty_slot()
196 stk[layer]->ary[pos] = cur_layer; // 最后别忘了记录儿子节点 in __idr_get_empty_slot()
257 struct idr_layer *cur_layer = idp->top; in __idr_get_path() local
258 int layer = cur_layer->layer; in __idr_get_path()
270 stk[layer] = cur_layer; in __idr_get_path()
273 if (unlikely(((cur_layer->bitmap >> layer_id) & 1) == 0)) in __idr_get_path()
279 cur_layer = cur_layer->ary[layer_id]; in __idr_get_path()
434 struct idr_layer *cur_layer = idp->top; in __idr_remove_all_with_free() local
435 int layer = cur_layer->layer; in __idr_remove_all_with_free()
439 while (cur_layer != NULL) in __idr_remove_all_with_free()
441 if (layer > 0 && cur_layer->bitmap) // 非叶子节点 in __idr_remove_all_with_free()
443 stk[layer] = cur_layer; // 入栈 in __idr_remove_all_with_free()
444 int64_t id = __lowbit_id(cur_layer->bitmap); in __idr_remove_all_with_free()
446 cur_layer->bitmap ^= (1ull << id); in __idr_remove_all_with_free()
447 cur_layer = cur_layer->ary[id]; in __idr_remove_all_with_free()
457 kfree(cur_layer->ary[i]); in __idr_remove_all_with_free()
458 cur_layer->ary[i] = NULL; in __idr_remove_all_with_free()
462 __idr_layer_free(cur_layer); // 释放空间记得设置为NULL in __idr_remove_all_with_free()
465 cur_layer = stk[layer]; // 出栈 in __idr_remove_all_with_free()
528 struct idr_layer *cur_layer = idp->top; in idr_find() local
529 int layer = cur_layer->layer; // 特判NULL in idr_find()
537 while (layer >= 0 && cur_layer != NULL) in idr_find()
542 cur_layer = cur_layer->ary[layer_id]; in idr_find()
545 return cur_layer; in idr_find()
580 struct idr_layer *cur_layer = idp->top; in idr_find_next_getid() local
583 int layer = cur_layer->layer; in idr_find_next_getid()
594 while (cur_layer) // layer < top->layer + 1 in idr_find_next_getid()
599 stk[layer] = cur_layer; in idr_find_next_getid()
610 unsigned long t_bitmap = (cur_layer->bitmap >> pos_i[layer]); in idr_find_next_getid()
625 return cur_layer->ary[layer_id]; in idr_find_next_getid()
628 cur_layer = cur_layer->ary[layer_id]; in idr_find_next_getid()
637 cur_layer = stk[layer]; in idr_find_next_getid()
684 struct idr_layer *cur_layer = idp->top; in idr_replace_get_old() local
685 int64_t layer = cur_layer->layer; in idr_replace_get_old()
694 if (unlikely(NULL == cur_layer->ary[layer_id])) in idr_replace_get_old()
697 cur_layer = cur_layer->ary[layer_id]; in idr_replace_get_old()
702 *old_ptr = cur_layer->ary[__id]; in idr_replace_get_old()
703 cur_layer->ary[__id] = ptr; in idr_replace_get_old()
743 static bool __idr_cnt_pd(struct idr_layer *cur_layer, int layer_id) in __idr_cnt_pd() argument
746 unsigned long flags = ((cur_layer->bitmap) >> layer_id); in __idr_cnt_pd()
755 static bool __idr_cnt(int layer, int id, struct idr_layer *cur_layer) in __idr_cnt() argument
766 if (__idr_cnt_pd(cur_layer, layer_id) == false) in __idr_cnt()
772 cur_layer = cur_layer->ary[layer_id]; in __idr_cnt()
796 struct idr_layer *cur_layer = idp->top; in idr_count() local
798 int layer = cur_layer->layer; in idr_count()
808 return __idr_cnt(layer, id, cur_layer); in idr_count()