From: Jens Axboe Date: Mon, 21 Jan 2013 16:43:30 +0000 (-0700) Subject: axmap: clear map->first_free when we reset it X-Git-Tag: fio-2.0.14~113 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=17f0fd39d8b1f8edb420721c38302bd46254db03 axmap: clear map->first_free when we reset it Otherwise it could be left at an invalid value. When we clear the map, we know the first free bit is 0. Signed-off-by: Jens Axboe --- diff --git a/lib/axmap.c b/lib/axmap.c index a44e0ecb..d9ad30bf 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -67,6 +67,8 @@ void axmap_reset(struct axmap *axmap) memset(al->map, 0, al->map_size * sizeof(unsigned long)); } + + axmap->first_free = 0; } void axmap_free(struct axmap *axmap) @@ -101,7 +103,6 @@ struct axmap *axmap_new(unsigned long nr_bits) axmap->nr_levels = levels; axmap->levels = smalloc(axmap->nr_levels * sizeof(struct axmap_level)); - axmap->first_free = 0; for (i = 0; i < axmap->nr_levels; i++) { struct axmap_level *al = &axmap->levels[i];