diff options
author | Tejun Heo <tj@kernel.org> | 2013-03-13 17:59:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-13 18:21:47 -0400 |
commit | c8615d3716fe327c2540cf514a34b227dc9b39e8 (patch) | |
tree | 2ad264bec1623c7b0cf43998b74654dd627a6e24 /lib/idr.c | |
parent | 8e467e855ca5ed2921f290655f96ac40d5dc571c (diff) |
idr: deprecate idr_pre_get() and idr_get_new[_above]()
Now that all in-kernel users are converted to ues the new alloc
interface, mark the old interface deprecated. We should be able to
remove these in a few releases.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/idr.c')
-rw-r--r-- | lib/idr.c | 41 |
1 files changed, 5 insertions, 36 deletions
@@ -184,20 +184,7 @@ static void idr_mark_full(struct idr_layer **pa, int id) | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | int __idr_pre_get(struct idr *idp, gfp_t gfp_mask) |
188 | * idr_pre_get - reserve resources for idr allocation | ||
189 | * @idp: idr handle | ||
190 | * @gfp_mask: memory allocation flags | ||
191 | * | ||
192 | * This function should be called prior to calling the idr_get_new* functions. | ||
193 | * It preallocates enough memory to satisfy the worst possible allocation. The | ||
194 | * caller should pass in GFP_KERNEL if possible. This of course requires that | ||
195 | * no spinning locks be held. | ||
196 | * | ||
197 | * If the system is REALLY out of memory this function returns %0, | ||
198 | * otherwise %1. | ||
199 | */ | ||
200 | int idr_pre_get(struct idr *idp, gfp_t gfp_mask) | ||
201 | { | 188 | { |
202 | while (idp->id_free_cnt < MAX_IDR_FREE) { | 189 | while (idp->id_free_cnt < MAX_IDR_FREE) { |
203 | struct idr_layer *new; | 190 | struct idr_layer *new; |
@@ -208,7 +195,7 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask) | |||
208 | } | 195 | } |
209 | return 1; | 196 | return 1; |
210 | } | 197 | } |
211 | EXPORT_SYMBOL(idr_pre_get); | 198 | EXPORT_SYMBOL(__idr_pre_get); |
212 | 199 | ||
213 | /** | 200 | /** |
214 | * sub_alloc - try to allocate an id without growing the tree depth | 201 | * sub_alloc - try to allocate an id without growing the tree depth |
@@ -375,25 +362,7 @@ static void idr_fill_slot(struct idr *idr, void *ptr, int id, | |||
375 | idr_mark_full(pa, id); | 362 | idr_mark_full(pa, id); |
376 | } | 363 | } |
377 | 364 | ||
378 | /** | 365 | int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) |
379 | * idr_get_new_above - allocate new idr entry above or equal to a start id | ||
380 | * @idp: idr handle | ||
381 | * @ptr: pointer you want associated with the id | ||
382 | * @starting_id: id to start search at | ||
383 | * @id: pointer to the allocated handle | ||
384 | * | ||
385 | * This is the allocate id function. It should be called with any | ||
386 | * required locks. | ||
387 | * | ||
388 | * If allocation from IDR's private freelist fails, idr_get_new_above() will | ||
389 | * return %-EAGAIN. The caller should retry the idr_pre_get() call to refill | ||
390 | * IDR's preallocation and then retry the idr_get_new_above() call. | ||
391 | * | ||
392 | * If the idr is full idr_get_new_above() will return %-ENOSPC. | ||
393 | * | ||
394 | * @id returns a value in the range @starting_id ... %0x7fffffff | ||
395 | */ | ||
396 | int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) | ||
397 | { | 366 | { |
398 | struct idr_layer *pa[MAX_IDR_LEVEL + 1]; | 367 | struct idr_layer *pa[MAX_IDR_LEVEL + 1]; |
399 | int rv; | 368 | int rv; |
@@ -406,7 +375,7 @@ int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) | |||
406 | *id = rv; | 375 | *id = rv; |
407 | return 0; | 376 | return 0; |
408 | } | 377 | } |
409 | EXPORT_SYMBOL(idr_get_new_above); | 378 | EXPORT_SYMBOL(__idr_get_new_above); |
410 | 379 | ||
411 | /** | 380 | /** |
412 | * idr_preload - preload for idr_alloc() | 381 | * idr_preload - preload for idr_alloc() |
@@ -907,7 +876,7 @@ static void free_bitmap(struct ida *ida, struct ida_bitmap *bitmap) | |||
907 | int ida_pre_get(struct ida *ida, gfp_t gfp_mask) | 876 | int ida_pre_get(struct ida *ida, gfp_t gfp_mask) |
908 | { | 877 | { |
909 | /* allocate idr_layers */ | 878 | /* allocate idr_layers */ |
910 | if (!idr_pre_get(&ida->idr, gfp_mask)) | 879 | if (!__idr_pre_get(&ida->idr, gfp_mask)) |
911 | return 0; | 880 | return 0; |
912 | 881 | ||
913 | /* allocate free_bitmap */ | 882 | /* allocate free_bitmap */ |