Skip to content

Commit

Permalink
id-pool: Allocate the lowest available ids.
Browse files Browse the repository at this point in the history
This simple change makes id-pool to always allocate the
lowest possible id from the pool. No any other code affected
because, actually, there is no users of 'id_pool_free_id' in
OVS.

This behaviour of id-pool will be used in the next patch.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
igsilya authored and blp committed Mar 9, 2017
1 parent a2673b6 commit f596e8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/id-pool.c
Expand Up @@ -148,6 +148,9 @@ id_pool_free_id(struct id_pool *pool, uint32_t id)
id_node = id_pool_find(pool, id);
if (id_node) {
hmap_remove(&pool->map, &id_node->node);
if (id < pool->next_free_id) {
pool->next_free_id = id;
}
free(id_node);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/id-pool.h
Expand Up @@ -35,7 +35,7 @@ void id_pool_add(struct id_pool *, uint32_t id);
* ========
*
* Pool of unique 32bit ids.
*
* Allocation always returns the lowest available id.
*
* Thread-safety
* =============
Expand Down

0 comments on commit f596e8e

Please sign in to comment.