Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Aug 31, 2017 Library code

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 63463983ce10e9678c5ad309608630eea873b4df:

Merge branch 'asmfix' of https://github.com/oohal/fio (2017-08-29 15:35:49 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 2b2fa7f5ecfd5cd5b54a209934b05b770e9c9301:

lib/axmap: a few fixes/cleanups (2017-08-30 13:03:26 -0600)

----------------------------------------------------------------
Jens Axboe (1):
lib/axmap: a few fixes/cleanups

 lib/axmap.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

---

Diff of recent changes:

lib/axmap.c +6 -4
index 2ee3a25..bf203df 100644
@@ -184,6 +184,9 @@ static bool axmap_clear_fn(struct axmap_level *al, unsigned long offset,
 void axmap_clear(struct axmap *axmap, uint64_t bit_nr)
 {
 	axmap_handler(axmap, bit_nr, axmap_clear_fn, NULL);
+
+	if (bit_nr < axmap->first_free)
+		axmap->first_free = bit_nr;
 }
 
 struct axmap_set_data {
@@ -191,7 +194,7 @@ struct axmap_set_data {
 	unsigned int set_bits;
 };
 
-static unsigned long bit_masks[] = {
+static const unsigned long bit_masks[] = {
 	0x0000000000000000, 0x0000000000000001, 0x0000000000000003, 0x0000000000000007,
 	0x000000000000000f, 0x000000000000001f, 0x000000000000003f, 0x000000000000007f,
 	0x00000000000000ff, 0x00000000000001ff, 0x00000000000003ff, 0x00000000000007ff,
@@ -372,10 +375,9 @@ static uint64_t axmap_find_first_free(struct axmap *axmap, unsigned int level,
 
 static uint64_t axmap_first_free(struct axmap *axmap)
 {
-	if (firstfree_valid(axmap))
-		return axmap->first_free;
+	if (!firstfree_valid(axmap))
+		axmap->first_free = axmap_find_first_free(axmap, axmap->nr_levels - 1, 0);
 
-	axmap->first_free = axmap_find_first_free(axmap, axmap->nr_levels - 1, 0);
 	return axmap->first_free;
 }