aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-03-23 22:38:30 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-03-23 22:38:30 -0400
commit9e41d9597e7825ec20d690013d32bcec5f3fe16a (patch)
treeac6fea59e9a4a1c2183d6bbd6ffa760680673afb /lib
parent77ecfe8d427f554fabbf258e9d789f1d4c3afd63 (diff)
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
Merge commit 'origin/master' into next
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c16
-rw-r--r--lib/idr.c2
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 1338469ac849..35a1f7ff4149 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -948,15 +948,15 @@ done:
948 */ 948 */
949int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) 949int bitmap_find_free_region(unsigned long *bitmap, int bits, int order)
950{ 950{
951 int pos; /* scans bitmap by regions of size order */ 951 int pos, end; /* scans bitmap by regions of size order */
952 952
953 for (pos = 0; pos < bits; pos += (1 << order)) 953 for (pos = 0 ; (end = pos + (1 << order)) <= bits; pos = end) {
954 if (__reg_op(bitmap, pos, order, REG_OP_ISFREE)) 954 if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
955 break; 955 continue;
956 if (pos == bits) 956 __reg_op(bitmap, pos, order, REG_OP_ALLOC);
957 return -ENOMEM; 957 return pos;
958 __reg_op(bitmap, pos, order, REG_OP_ALLOC); 958 }
959 return pos; 959 return -ENOMEM;
960} 960}
961EXPORT_SYMBOL(bitmap_find_free_region); 961EXPORT_SYMBOL(bitmap_find_free_region);
962 962
diff --git a/lib/idr.c b/lib/idr.c
index c11c5765cdef..dab4bca86f5d 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -449,6 +449,7 @@ void idr_remove_all(struct idr *idp)
449 449
450 n = idp->layers * IDR_BITS; 450 n = idp->layers * IDR_BITS;
451 p = idp->top; 451 p = idp->top;
452 rcu_assign_pointer(idp->top, NULL);
452 max = 1 << n; 453 max = 1 << n;
453 454
454 id = 0; 455 id = 0;
@@ -467,7 +468,6 @@ void idr_remove_all(struct idr *idp)
467 p = *--paa; 468 p = *--paa;
468 } 469 }
469 } 470 }
470 rcu_assign_pointer(idp->top, NULL);
471 idp->layers = 0; 471 idp->layers = 0;
472} 472}
473EXPORT_SYMBOL(idr_remove_all); 473EXPORT_SYMBOL(idr_remove_all);