diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-23 22:38:30 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-23 22:38:30 -0400 |
commit | 9e41d9597e7825ec20d690013d32bcec5f3fe16a (patch) | |
tree | ac6fea59e9a4a1c2183d6bbd6ffa760680673afb /lib | |
parent | 77ecfe8d427f554fabbf258e9d789f1d4c3afd63 (diff) | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) |
Merge commit 'origin/master' into next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 16 | ||||
-rw-r--r-- | lib/idr.c | 2 |
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 | */ |
949 | int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) | 949 | int 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 | } |
961 | EXPORT_SYMBOL(bitmap_find_free_region); | 961 | EXPORT_SYMBOL(bitmap_find_free_region); |
962 | 962 | ||
@@ -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 | } |
473 | EXPORT_SYMBOL(idr_remove_all); | 473 | EXPORT_SYMBOL(idr_remove_all); |