summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c4fc0ff)
Was multiplying by the bit-size, not the byte-size. No algorithmic
changes, we never used the 7/8ths of the memory at the end...
Signed-off-by: Jens Axboe <axboe@kernel.dk>
#include "../minmax.h"
#if BITS_PER_LONG == 64
#include "../minmax.h"
#if BITS_PER_LONG == 64
#define UNIT_SHIFT 6
#elif BITS_PER_LONG == 32
#define UNIT_SHIFT 6
#elif BITS_PER_LONG == 32
#define UNIT_SHIFT 5
#else
#error "Number of arch bits unknown"
#define UNIT_SHIFT 5
#else
#error "Number of arch bits unknown"
for (i = 0; i < bitmap->nr_levels; i++) {
struct bitmap_level *bl = &bitmap->levels[i];
for (i = 0; i < bitmap->nr_levels; i++) {
struct bitmap_level *bl = &bitmap->levels[i];
- memset(bl->map, 0, bl->map_size * UNIT_SIZE);
+ memset(bl->map, 0, bl->map_size * sizeof(unsigned long));
bl->level = i;
bl->map_size = (nr_bits + BLOCKS_PER_UNIT - 1) >> UNIT_SHIFT;
bl->level = i;
bl->map_size = (nr_bits + BLOCKS_PER_UNIT - 1) >> UNIT_SHIFT;
- bl->map = smalloc(bl->map_size << UNIT_SHIFT);
+ bl->map = smalloc(bl->map_size * sizeof(unsigned long));