flexnbd: We only require 1/8th of the memory we allocate for bitsets (bits vs. bytes confusion)

This commit is contained in:
nick
2015-05-13 09:25:09 +01:00
parent c363991cfd
commit 20f99b4554

View File

@@ -186,7 +186,7 @@ static inline struct bitset *bitset_alloc( uint64_t size, int resolution )
// bitfield word
size_t bitfield_size =
BIT_WORDS_FOR_SIZE((( size + resolution - 1 ) / resolution)) * sizeof( bitfield_word_t );
struct bitset *bitset = xmalloc(sizeof( struct bitset ) + bitfield_size);
struct bitset *bitset = xmalloc(sizeof( struct bitset ) + ( bitfield_size / 8 ) );
bitset->size = size;
bitset->resolution = resolution;