Lines Matching refs:idr
33 int idr_alloc_u32(struct idr *idr, void *ptr, u32 *nextid, in idr_alloc_u32() argument
38 unsigned int base = idr->idr_base; in idr_alloc_u32()
41 if (WARN_ON_ONCE(!(idr->idr_rt.xa_flags & ROOT_IS_IDR))) in idr_alloc_u32()
42 idr->idr_rt.xa_flags |= IDR_RT_MARKER; in idr_alloc_u32()
46 slot = idr_get_free(&idr->idr_rt, &iter, gfp, max - base); in idr_alloc_u32()
52 radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr); in idr_alloc_u32()
53 radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE); in idr_alloc_u32()
79 int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) in idr_alloc() argument
87 ret = idr_alloc_u32(idr, ptr, &id, end > 0 ? end - 1 : INT_MAX, gfp); in idr_alloc()
117 int idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp) in idr_alloc_cyclic() argument
119 u32 id = idr->idr_next; in idr_alloc_cyclic()
125 err = idr_alloc_u32(idr, ptr, &id, max, gfp); in idr_alloc_cyclic()
128 err = idr_alloc_u32(idr, ptr, &id, max, gfp); in idr_alloc_cyclic()
133 idr->idr_next = id + 1; in idr_alloc_cyclic()
152 void *idr_remove(struct idr *idr, unsigned long id) in idr_remove() argument
154 return radix_tree_delete_item(&idr->idr_rt, id - idr->idr_base, NULL); in idr_remove()
172 void *idr_find(const struct idr *idr, unsigned long id) in idr_find() argument
174 return radix_tree_lookup(&idr->idr_rt, id - idr->idr_base); in idr_find()
195 int idr_for_each(const struct idr *idr, in idr_for_each() argument
200 int base = idr->idr_base; in idr_for_each()
202 radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, 0) { in idr_for_each()
227 void *idr_get_next_ul(struct idr *idr, unsigned long *nextid) in idr_get_next_ul() argument
232 unsigned long base = idr->idr_base; in idr_get_next_ul()
236 radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, id) { in idr_get_next_ul()
242 if (slot != &idr->idr_rt.xa_head && !xa_is_retry(entry)) in idr_get_next_ul()
264 void *idr_get_next(struct idr *idr, int *nextid) in idr_get_next() argument
267 void *entry = idr_get_next_ul(idr, &id); in idr_get_next()
290 void *idr_replace(struct idr *idr, void *ptr, unsigned long id) in idr_replace() argument
296 id -= idr->idr_base; in idr_replace()
298 entry = __radix_tree_lookup(&idr->idr_rt, id, &node, &slot); in idr_replace()
299 if (!slot || radix_tree_tag_get(&idr->idr_rt, id, IDR_FREE)) in idr_replace()
302 __radix_tree_replace(&idr->idr_rt, node, slot, ptr); in idr_replace()