diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-28 12:31:34 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-28 12:31:34 -0400 |
commit | 96b88fb850cc419171f926ad04650ec509e9f543 (patch) | |
tree | 5bf9537bde467534608b3acdbfa5f7726ede8c3f /lib/idr.c | |
parent | e78a57de94480226f7fc90d0b4837bfc6c99a9e0 (diff) | |
parent | 5fadd053d9bb4345ec6f405d24db4e7eb49cf81e (diff) |
Merge branch 'master'
Diffstat (limited to 'lib/idr.c')
-rw-r--r-- | lib/idr.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/idr.c b/lib/idr.c index 6415d053e2b..6414b2fb482 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -72,7 +72,7 @@ static void free_layer(struct idr *idp, struct idr_layer *p) * If the system is REALLY out of memory this function returns 0, * otherwise 1. */ -int idr_pre_get(struct idr *idp, unsigned gfp_mask) +int idr_pre_get(struct idr *idp, gfp_t gfp_mask) { while (idp->id_free_cnt < IDR_FREE_MAX) { struct idr_layer *new; @@ -346,6 +346,19 @@ void idr_remove(struct idr *idp, int id) EXPORT_SYMBOL(idr_remove); /** + * idr_destroy - release all cached layers within an idr tree + * idp: idr handle + */ +void idr_destroy(struct idr *idp) +{ + while (idp->id_free_cnt) { + struct idr_layer *p = alloc_layer(idp); + kmem_cache_free(idr_layer_cache, p); + } +} +EXPORT_SYMBOL(idr_destroy); + +/** * idr_find - return pointer for given id * @idp: idr handle * @id: lookup key |