aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r--lib/bitmap.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index b499ab6ada29..969ae8fbc85b 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -326,30 +326,32 @@ void bitmap_clear(unsigned long *map, unsigned int start, int len)
326} 326}
327EXPORT_SYMBOL(bitmap_clear); 327EXPORT_SYMBOL(bitmap_clear);
328 328
329/* 329/**
330 * bitmap_find_next_zero_area - find a contiguous aligned zero area 330 * bitmap_find_next_zero_area_off - find a contiguous aligned zero area
331 * @map: The address to base the search on 331 * @map: The address to base the search on
332 * @size: The bitmap size in bits 332 * @size: The bitmap size in bits
333 * @start: The bitnumber to start searching at 333 * @start: The bitnumber to start searching at
334 * @nr: The number of zeroed bits we're looking for 334 * @nr: The number of zeroed bits we're looking for
335 * @align_mask: Alignment mask for zero area 335 * @align_mask: Alignment mask for zero area
336 * @align_offset: Alignment offset for zero area.
336 * 337 *
337 * The @align_mask should be one less than a power of 2; the effect is that 338 * The @align_mask should be one less than a power of 2; the effect is that
338 * the bit offset of all zero areas this function finds is multiples of that 339 * the bit offset of all zero areas this function finds plus @align_offset
339 * power of 2. A @align_mask of 0 means no alignment is required. 340 * is multiple of that power of 2.
340 */ 341 */
341unsigned long bitmap_find_next_zero_area(unsigned long *map, 342unsigned long bitmap_find_next_zero_area_off(unsigned long *map,
342 unsigned long size, 343 unsigned long size,
343 unsigned long start, 344 unsigned long start,
344 unsigned int nr, 345 unsigned int nr,
345 unsigned long align_mask) 346 unsigned long align_mask,
347 unsigned long align_offset)
346{ 348{
347 unsigned long index, end, i; 349 unsigned long index, end, i;
348again: 350again:
349 index = find_next_zero_bit(map, size, start); 351 index = find_next_zero_bit(map, size, start);
350 352
351 /* Align allocation */ 353 /* Align allocation */
352 index = __ALIGN_MASK(index, align_mask); 354 index = __ALIGN_MASK(index + align_offset, align_mask) - align_offset;
353 355
354 end = index + nr; 356 end = index + nr;
355 if (end > size) 357 if (end > size)
@@ -361,7 +363,7 @@ again:
361 } 363 }
362 return index; 364 return index;
363} 365}
364EXPORT_SYMBOL(bitmap_find_next_zero_area); 366EXPORT_SYMBOL(bitmap_find_next_zero_area_off);
365 367
366/* 368/*
367 * Bitmap printing & parsing functions: first version by Nadia Yvette Chambers, 369 * Bitmap printing & parsing functions: first version by Nadia Yvette Chambers,