|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2012 Institute of Communication and Computer Systems (ICCS)
|
|
|
+ * Copyright Institute of Communication and Computer Systems (ICCS)
|
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -77,7 +77,9 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
pthread_mutex_lock(&raw_block->mutex);
|
|
|
#endif /* HAVE_LOCKS */
|
|
|
|
|
|
- copy_array(temp1, &rb_header->bmap, rb_header->elements);
|
|
|
+ bmap_p = (BMAP_EL_TYPE *)((char *)rb_header + sizeof(bitmap_rb_t));
|
|
|
+
|
|
|
+ copy_array(temp1, bmap_p, rb_header->elements);
|
|
|
|
|
|
// perform bitwise shift & and operations in the BMAP_EL_TYPE arrays
|
|
|
for(i = 1; i < stop; i <<= 1) {
|
|
@@ -93,7 +95,6 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
|
|
|
found = 0;
|
|
|
|
|
|
- bmap_p = &rb_header->bmap;
|
|
|
for(i = 0; i < rb_header->elements; ++i) {
|
|
|
found = __builtin_ffsl(temp1[i]);
|
|
|
if(found) {
|
|
@@ -111,7 +112,7 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
// Calculate the pointer to the chunk to be retrieved
|
|
|
chunk_address = (chunk_header_t *)((char *)rb_header +
|
|
|
sizeof(bitmap_rb_t) +
|
|
|
- (rb_header->elements - 1) * BMAP_EL_SIZE +
|
|
|
+ rb_header->elements * BMAP_EL_SIZE +
|
|
|
(i * BMAP_EL_SIZE_BITS + found - 1) *
|
|
|
rb_header->bytes_per_cell);
|
|
|
chunk_address->num_of_cells = cells;
|