*/
#include <linux/smp_lock.h>
+#include <linux/bitops.h>
#include <asm/bitext.h>
-#include <asm/bitops.h>
/**
* bit_map_string_get - find and set a bit string in bit map.
int offset, count; /* siamese twins */
int off_new;
int align1;
- int i;
+ int i, color;
- if (align == 0)
- align = 1;
+ if (t->num_colors) {
+ /* align is overloaded to be the page color */
+ color = align;
+ align = t->num_colors;
+ } else {
+ color = 0;
+ if (align == 0)
+ align = 1;
+ }
align1 = align - 1;
if ((align & align1) != 0)
BUG();
BUG();
if (len <= 0 || len > t->size)
BUG();
+ color &= align1;
spin_lock(&t->lock);
if (len < t->last_size)
count = 0;
for (;;) {
off_new = find_next_zero_bit(t->map, t->size, offset);
- off_new = (off_new + align1) & ~align1;
+ off_new = ((off_new + align1) & ~align1) + color;
count += off_new - offset;
offset = off_new;
if (offset >= t->size)
spin_lock_init(&t->lock);
t->map = map;
t->size = size;
- t->last_size = 0;
- t->first_free = 0;
}