• Home
  • Raw
  • Download

Lines Matching refs:p

68 	struct idr_layer *p;  in get_from_free_list()  local
72 if ((p = idp->id_free)) { in get_from_free_list()
73 idp->id_free = p->ary[0]; in get_from_free_list()
75 p->ary[0] = NULL; in get_from_free_list()
78 return(p); in get_from_free_list()
145 static inline void free_layer(struct idr *idr, struct idr_layer *p) in free_layer() argument
147 if (idr->hint == p) in free_layer()
149 call_rcu(&p->rcu_head, idr_layer_rcu_free); in free_layer()
153 static void __move_to_free_list(struct idr *idp, struct idr_layer *p) in __move_to_free_list() argument
155 p->ary[0] = idp->id_free; in __move_to_free_list()
156 idp->id_free = p; in __move_to_free_list()
160 static void move_to_free_list(struct idr *idp, struct idr_layer *p) in move_to_free_list() argument
168 __move_to_free_list(idp, p); in move_to_free_list()
174 struct idr_layer *p = pa[0]; in idr_mark_full() local
177 __set_bit(id & IDR_MASK, p->bitmap); in idr_mark_full()
184 while (bitmap_full(p->bitmap, IDR_SIZE)) { in idr_mark_full()
185 if (!(p = pa[++l])) in idr_mark_full()
188 __set_bit((id & IDR_MASK), p->bitmap); in idr_mark_full()
224 struct idr_layer *p, *new; in sub_alloc() local
229 p = idp->top; in sub_alloc()
237 m = find_next_zero_bit(p->bitmap, IDR_SIZE, n); in sub_alloc()
249 p = pa[l]; in sub_alloc()
250 BUG_ON(!p); in sub_alloc()
272 if (!p->ary[m]) { in sub_alloc()
278 rcu_assign_pointer(p->ary[m], new); in sub_alloc()
279 p->count++; in sub_alloc()
281 pa[l--] = p; in sub_alloc()
282 p = p->ary[m]; in sub_alloc()
285 pa[l] = p; in sub_alloc()
293 struct idr_layer *p, *new; in idr_get_empty_slot() local
299 p = idp->top; in idr_get_empty_slot()
301 if (unlikely(!p)) { in idr_get_empty_slot()
302 if (!(p = idr_layer_alloc(gfp_mask, layer_idr))) in idr_get_empty_slot()
304 p->layer = 0; in idr_get_empty_slot()
313 if (!p->count) { in idr_get_empty_slot()
318 p->layer++; in idr_get_empty_slot()
319 WARN_ON_ONCE(p->prefix); in idr_get_empty_slot()
328 for (new = p; p && p != idp->top; new = p) { in idr_get_empty_slot()
329 p = p->ary[0]; in idr_get_empty_slot()
338 new->ary[0] = p; in idr_get_empty_slot()
342 if (bitmap_full(p->bitmap, IDR_SIZE)) in idr_get_empty_slot()
344 p = new; in idr_get_empty_slot()
346 rcu_assign_pointer(idp->top, p); in idr_get_empty_slot()
510 struct idr_layer *p = idp->top; in sub_remove() local
519 while ((shift > 0) && p) { in sub_remove()
521 __clear_bit(n, p->bitmap); in sub_remove()
522 *++paa = &p->ary[n]; in sub_remove()
523 p = p->ary[n]; in sub_remove()
527 if (likely(p != NULL && test_bit(n, p->bitmap))) { in sub_remove()
528 __clear_bit(n, p->bitmap); in sub_remove()
529 RCU_INIT_POINTER(p->ary[n], NULL); in sub_remove()
552 struct idr_layer *p; in idr_remove() local
573 p = idp->top->ary[0]; in idr_remove()
574 rcu_assign_pointer(idp->top, p); in idr_remove()
587 struct idr_layer *p; in __idr_remove_all() local
598 p = *paa; in __idr_remove_all()
599 while (n > IDR_BITS && p) { in __idr_remove_all()
601 p = p->ary[(id >> n) & IDR_MASK]; in __idr_remove_all()
602 *++paa = p; in __idr_remove_all()
636 struct idr_layer *p = get_from_free_list(idp); in idr_destroy() local
637 kmem_cache_free(idr_layer_cache, p); in idr_destroy()
645 struct idr_layer *p; in idr_find_slowpath() local
650 p = rcu_dereference_raw(idp->top); in idr_find_slowpath()
651 if (!p) in idr_find_slowpath()
653 n = (p->layer+1) * IDR_BITS; in idr_find_slowpath()
655 if (id > idr_max(p->layer + 1)) in idr_find_slowpath()
659 while (n > 0 && p) { in idr_find_slowpath()
661 BUG_ON(n != p->layer*IDR_BITS); in idr_find_slowpath()
662 p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]); in idr_find_slowpath()
664 return((void *)p); in idr_find_slowpath()
687 int (*fn)(int id, void *p, void *data), void *data) in idr_for_each() argument
690 struct idr_layer *p; in idr_for_each() local
700 p = *paa; in idr_for_each()
701 while (n > 0 && p) { in idr_for_each()
703 p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]); in idr_for_each()
704 *++paa = p; in idr_for_each()
707 if (p) { in idr_for_each()
708 error = fn(id, (void *)p, data); in idr_for_each()
738 struct idr_layer *p, *pa[MAX_IDR_LEVEL + 1]; in idr_get_next() local
744 p = *paa = rcu_dereference_raw(idp->top); in idr_get_next()
745 if (!p) in idr_get_next()
747 n = (p->layer + 1) * IDR_BITS; in idr_get_next()
748 max = idr_max(p->layer + 1); in idr_get_next()
751 p = *paa; in idr_get_next()
752 while (n > 0 && p) { in idr_get_next()
754 p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]); in idr_get_next()
755 *++paa = p; in idr_get_next()
758 if (p) { in idr_get_next()
760 return p; in idr_get_next()
796 struct idr_layer *p, *old_p; in idr_replace() local
801 p = idp->top; in idr_replace()
802 if (!p) in idr_replace()
805 if (id > idr_max(p->layer + 1)) in idr_replace()
808 n = p->layer * IDR_BITS; in idr_replace()
809 while ((n > 0) && p) { in idr_replace()
810 p = p->ary[(id >> n) & IDR_MASK]; in idr_replace()
815 if (unlikely(p == NULL || !test_bit(n, p->bitmap))) in idr_replace()
818 old_p = p->ary[n]; in idr_replace()
819 rcu_assign_pointer(p->ary[n], ptr); in idr_replace()
845 static int idr_has_entry(int id, void *p, void *data) in idr_has_entry() argument
996 struct idr_layer *p = get_from_free_list(&ida->idr); in ida_get_new_above() local
997 if (p) in ida_get_new_above()
998 kmem_cache_free(idr_layer_cache, p); in ida_get_new_above()
1012 struct idr_layer *p = ida->idr.top; in ida_remove() local
1023 while ((shift > 0) && p) { in ida_remove()
1025 __clear_bit(n, p->bitmap); in ida_remove()
1026 p = p->ary[n]; in ida_remove()
1030 if (p == NULL) in ida_remove()
1034 __clear_bit(n, p->bitmap); in ida_remove()
1036 bitmap = (void *)p->ary[n]; in ida_remove()
1043 __set_bit(n, p->bitmap); /* to please idr_remove() */ in ida_remove()