diff options
author | Paul Mackerras <paulus@samba.org> | 2006-08-01 02:37:25 +0200 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-08-01 02:37:25 +0200 |
commit | 57cad8084e0837e0f2c97da789ec9b3f36809be9 (patch) | |
tree | e9c790afb4286f78cb08d9664f58baa7e876fe55 /lib/idr.c | |
parent | [POWERPC] Instrument Hypervisor Calls: merge headers (diff) | |
parent | Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/... (diff) | |
download | linux-57cad8084e0837e0f2c97da789ec9b3f36809be9.tar.xz linux-57cad8084e0837e0f2c97da789ec9b3f36809be9.zip |
Merge branch 'merge'
Diffstat (limited to 'lib/idr.c')
-rw-r--r-- | lib/idr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/idr.c b/lib/idr.c index 4d096819511a..16d2143fea48 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -38,14 +38,15 @@ static kmem_cache_t *idr_layer_cache; static struct idr_layer *alloc_layer(struct idr *idp) { struct idr_layer *p; + unsigned long flags; - spin_lock(&idp->lock); + spin_lock_irqsave(&idp->lock, flags); if ((p = idp->id_free)) { idp->id_free = p->ary[0]; idp->id_free_cnt--; p->ary[0] = NULL; } - spin_unlock(&idp->lock); + spin_unlock_irqrestore(&idp->lock, flags); return(p); } @@ -59,12 +60,14 @@ static void __free_layer(struct idr *idp, struct idr_layer *p) static void free_layer(struct idr *idp, struct idr_layer *p) { + unsigned long flags; + /* * Depends on the return element being zeroed. */ - spin_lock(&idp->lock); + spin_lock_irqsave(&idp->lock, flags); __free_layer(idp, p); - spin_unlock(&idp->lock); + spin_unlock_irqrestore(&idp->lock, flags); } /** @@ -168,6 +171,7 @@ static int idr_get_new_above_int(struct idr *idp, void *ptr, int starting_id) { struct idr_layer *p, *new; int layers, v, id; + unsigned long flags; id = starting_id; build_up: @@ -191,14 +195,14 @@ build_up: * The allocation failed. If we built part of * the structure tear it down. */ - spin_lock(&idp->lock); + spin_lock_irqsave(&idp->lock, flags); for (new = p; p && p != idp->top; new = p) { p = p->ary[0]; new->ary[0] = NULL; new->bitmap = new->count = 0; __free_layer(idp, new); } - spin_unlock(&idp->lock); + spin_unlock_irqrestore(&idp->lock, flags); return -1; } new->ary[0] = p; |