X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Faxmap.c;h=767a73177d3f0b7e58837441f7d46fece03652b2;hb=604d3f5bd9f2b985568593c23f8292cbc7f4044c;hp=03e712f53be7a7623f90b12a3eecf57d73fc6f62;hpb=84a815f5535cc9ac56e6c45926f0a2f4fe7c4b3f;p=fio.git diff --git a/lib/axmap.c b/lib/axmap.c index 03e712f5..767a7317 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -110,7 +110,7 @@ void axmap_free(struct axmap *axmap) } /* Allocate memory for a set that can store the numbers 0 .. @nr_bits - 1. */ -struct axmap *axmap_new(unsigned long nr_bits) +struct axmap *axmap_new(uint64_t nr_bits) { struct axmap *axmap; unsigned int i, levels; @@ -135,13 +135,14 @@ struct axmap *axmap_new(unsigned long nr_bits) for (i = 0; i < axmap->nr_levels; i++) { struct axmap_level *al = &axmap->levels[i]; + nr_bits = (nr_bits + BLOCKS_PER_UNIT - 1) >> UNIT_SHIFT; + al->level = i; - al->map_size = (nr_bits + BLOCKS_PER_UNIT - 1) >> UNIT_SHIFT; + al->map_size = nr_bits; al->map = malloc(al->map_size * sizeof(unsigned long)); if (!al->map) goto free_levels; - nr_bits = (nr_bits + BLOCKS_PER_UNIT - 1) >> UNIT_SHIFT; } axmap_reset(axmap);