Lines Matching refs:idr

34 int idr_alloc_u32(struct idr *idr, void *ptr, u32 *nextid,  in idr_alloc_u32()  argument
39 unsigned int base = idr->idr_base; in idr_alloc_u32()
44 if (WARN_ON_ONCE(!(idr->idr_rt.gfp_mask & ROOT_IS_IDR))) in idr_alloc_u32()
45 idr->idr_rt.gfp_mask |= IDR_RT_MARKER; in idr_alloc_u32()
49 slot = idr_get_free(&idr->idr_rt, &iter, gfp, max - base); in idr_alloc_u32()
55 radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr); in idr_alloc_u32()
56 radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE); in idr_alloc_u32()
82 int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) in idr_alloc() argument
90 ret = idr_alloc_u32(idr, ptr, &id, end > 0 ? end - 1 : INT_MAX, gfp); in idr_alloc()
120 int idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) in idr_alloc_cyclic() argument
122 u32 id = idr->idr_next; in idr_alloc_cyclic()
128 err = idr_alloc_u32(idr, ptr, &id, max, gfp); in idr_alloc_cyclic()
131 err = idr_alloc_u32(idr, ptr, &id, max, gfp); in idr_alloc_cyclic()
136 idr->idr_next = id + 1; in idr_alloc_cyclic()
155 void *idr_remove(struct idr *idr, unsigned long id) in idr_remove() argument
157 return radix_tree_delete_item(&idr->idr_rt, id - idr->idr_base, NULL); in idr_remove()
175 void *idr_find(const struct idr *idr, unsigned long id) in idr_find() argument
177 return radix_tree_lookup(&idr->idr_rt, id - idr->idr_base); in idr_find()
198 int idr_for_each(const struct idr *idr, in idr_for_each() argument
203 int base = idr->idr_base; in idr_for_each()
205 radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { in idr_for_each()
230 void *idr_get_next_ul(struct idr *idr, unsigned long *nextid) in idr_get_next_ul() argument
235 unsigned long base = idr->idr_base; in idr_get_next_ul()
239 radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, id) { in idr_get_next_ul()
245 if (slot != (void *)&idr->idr_rt.rnode && in idr_get_next_ul()
268 void *idr_get_next(struct idr *idr, int *nextid) in idr_get_next() argument
271 void *entry = idr_get_next_ul(idr, &id); in idr_get_next()
294 void *idr_replace(struct idr *idr, void *ptr, unsigned long id) in idr_replace() argument
302 id -= idr->idr_base; in idr_replace()
304 entry = __radix_tree_lookup(&idr->idr_rt, id, &node, &slot); in idr_replace()
305 if (!slot || radix_tree_tag_get(&idr->idr_rt, id, IDR_FREE)) in idr_replace()
308 __radix_tree_replace(&idr->idr_rt, node, slot, ptr, NULL); in idr_replace()