git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mtd: kirkwood: allow machines to register RnB callback
[safe/jmp/linux-2.6]
/
lib
/
idr.c
diff --git
a/lib/idr.c
b/lib/idr.c
index
1cac726
..
422a9d5
100644
(file)
--- a/
lib/idr.c
+++ b/
lib/idr.c
@@
-156,10
+156,12
@@
static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa)
id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
/* if already at the top layer, we need to grow */
id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
/* if already at the top layer, we need to grow */
- if (
!(p = pa[l]
)) {
+ if (
id >= 1 << (idp->layers * IDR_BITS
)) {
*starting_id = id;
return IDR_NEED_TO_GROW;
}
*starting_id = id;
return IDR_NEED_TO_GROW;
}
+ p = pa[l];
+ BUG_ON(!p);
/* If we need to go up one layer, continue the
* loop; otherwise, restart from the top.
/* If we need to go up one layer, continue the
* loop; otherwise, restart from the top.
@@
-502,7
+504,7
@@
void *idr_find(struct idr *idp, int id)
int n;
struct idr_layer *p;
int n;
struct idr_layer *p;
- p = rcu_dereference(idp->top);
+ p = rcu_dereference
_raw
(idp->top);
if (!p)
return NULL;
n = (p->layer+1) * IDR_BITS;
if (!p)
return NULL;
n = (p->layer+1) * IDR_BITS;
@@
-517,7
+519,7
@@
void *idr_find(struct idr *idp, int id)
while (n > 0 && p) {
n -= IDR_BITS;
BUG_ON(n != p->layer*IDR_BITS);
while (n > 0 && p) {
n -= IDR_BITS;
BUG_ON(n != p->layer*IDR_BITS);
- p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+ p = rcu_dereference
_raw
(p->ary[(id >> n) & IDR_MASK]);
}
return((void *)p);
}
}
return((void *)p);
}
@@
-550,7
+552,7
@@
int idr_for_each(struct idr *idp,
struct idr_layer **paa = &pa[0];
n = idp->layers * IDR_BITS;
struct idr_layer **paa = &pa[0];
n = idp->layers * IDR_BITS;
- p = rcu_dereference(idp->top);
+ p = rcu_dereference
_raw
(idp->top);
max = 1 << n;
id = 0;
max = 1 << n;
id = 0;
@@
-558,7
+560,7
@@
int idr_for_each(struct idr *idp,
while (n > 0 && p) {
n -= IDR_BITS;
*paa++ = p;
while (n > 0 && p) {
n -= IDR_BITS;
*paa++ = p;
- p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+ p = rcu_dereference
_raw
(p->ary[(id >> n) & IDR_MASK]);
}
if (p) {
}
if (p) {
@@
-621,7
+623,7
@@
void *idr_get_next(struct idr *idp, int *nextidp)
}
return NULL;
}
}
return NULL;
}
-
+EXPORT_SYMBOL(idr_get_next);
/**
/**