if (result != UDS_SUCCESS)
return result;
- result = vdo_make_int_map(cache->page_count, 0, &cache->page_map);
+ result = vdo_int_map_create(cache->page_count, 0, &cache->page_map);
if (result != UDS_SUCCESS)
return result;
}
/* Reset the page map by re-allocating it. */
- vdo_free_int_map(uds_forget(cache->page_map));
- return vdo_make_int_map(cache->page_count, 0, &cache->page_map);
+ vdo_int_map_free(uds_forget(cache->page_map));
+ return vdo_int_map_create(cache->page_count, 0, &cache->page_map);
}
/**
INIT_LIST_HEAD(&zone->dirty_lists->eras[i][VDO_CACHE_PAGE]);
}
- result = vdo_make_int_map(VDO_LOCK_MAP_CAPACITY, 0, &zone->loading_pages);
+ result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->loading_pages);
if (result != VDO_SUCCESS)
return result;
uds_free(uds_forget(zone->dirty_lists));
free_vio_pool(uds_forget(zone->vio_pool));
- vdo_free_int_map(uds_forget(zone->loading_pages));
+ vdo_int_map_free(uds_forget(zone->loading_pages));
if (cache->infos != NULL) {
struct page_info *info;
free_vio(uds_forget(info->vio));
}
- vdo_free_int_map(uds_forget(cache->page_map));
+ vdo_int_map_free(uds_forget(cache->page_map));
uds_free(uds_forget(cache->infos));
uds_free(uds_forget(cache->pages));
}
data_vio_count_t i;
struct hash_zone *zone = &zones->zones[zone_number];
- result = vdo_make_int_map(VDO_LOCK_MAP_CAPACITY, 0, &zone->hash_lock_map);
+ result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->hash_lock_map);
if (result != VDO_SUCCESS)
return result;
struct hash_zone *zone = &zones->zones[i];
uds_free_funnel_queue(uds_forget(zone->timed_out_complete));
- vdo_free_int_map(uds_forget(zone->hash_lock_map));
+ vdo_int_map_free(uds_forget(zone->hash_lock_map));
uds_free(uds_forget(zone->lock_array));
}
}
/**
- * vdo_make_int_map() - Allocate and initialize an int_map.
+ * vdo_int_map_create() - Allocate and initialize an int_map.
* @initial_capacity: The number of entries the map should initially be capable of holding (zero
* tells the map to use its own small default).
* @initial_load: The load factor of the map, expressed as an integer percentage (typically in the
*
* Return: UDS_SUCCESS or an error code.
*/
-int vdo_make_int_map(size_t initial_capacity, unsigned int initial_load, struct int_map **map_ptr)
+int vdo_int_map_create(size_t initial_capacity, unsigned int initial_load,
+ struct int_map **map_ptr)
{
struct int_map *map;
int result;
result = allocate_buckets(map, capacity);
if (result != UDS_SUCCESS) {
- vdo_free_int_map(uds_forget(map));
+ vdo_int_map_free(uds_forget(map));
return result;
}
}
/**
- * vdo_free_int_map() - Free an int_map.
+ * vdo_int_map_free() - Free an int_map.
* @map: The int_map to free.
*
* NOTE: The map does not own the pointer values stored in the map and they are not freed by this
* call.
*/
-void vdo_free_int_map(struct int_map *map)
+void vdo_int_map_free(struct int_map *map)
{
if (map == NULL)
return;
* Return: The bucket that was vacated by moving its entry to the provided hole, or NULL if no
* entry could be moved.
*/
-static struct bucket *move_empty_bucket(struct int_map *map __always_unused, struct bucket *hole)
+static struct bucket *move_empty_bucket(struct int_map *map __always_unused,
+ struct bucket *hole)
{
/*
* Examine every neighborhood that the empty bucket is part of, starting with the one in
* Return: a pointer to an empty bucket in the desired neighborhood, or NULL if a vacancy could not
* be found or arranged.
*/
-static struct bucket *find_or_make_vacancy(struct int_map *map, struct bucket *neighborhood)
+static struct bucket *find_or_make_vacancy(struct int_map *map,
+ struct bucket *neighborhood)
{
/* Probe within and beyond the neighborhood for the first empty bucket. */
struct bucket *hole = find_empty_bucket(map, neighborhood, MAX_PROBES);
*
* Return: UDS_SUCCESS or an error code.
*/
-int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update, void **old_value_ptr)
+int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
+ void **old_value_ptr)
{
struct bucket *neighborhood, *bucket;
struct int_map;
-int __must_check
-vdo_make_int_map(size_t initial_capacity, unsigned int initial_load, struct int_map **map_ptr);
+int __must_check vdo_int_map_create(size_t initial_capacity, unsigned int initial_load,
+ struct int_map **map_ptr);
-void vdo_free_int_map(struct int_map *map);
+void vdo_int_map_free(struct int_map *map);
size_t vdo_int_map_size(const struct int_map *map);
void *vdo_int_map_get(struct int_map *map, u64 key);
-int __must_check
-vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update, void **old_value_ptr);
+int __must_check vdo_int_map_put(struct int_map *map, u64 key, void *new_value,
+ bool update, void **old_value_ptr);
void *vdo_int_map_remove(struct int_map *map, u64 key);
* uneven. So for now, we'll assume that all requests *may* wind up on one thread,
* and thus all in the same map.
*/
- result = vdo_make_int_map(max_requests_active * 2, 0,
- &bio_queue_data->map);
+ result = vdo_int_map_create(max_requests_active * 2, 0,
+ &bio_queue_data->map);
if (result != 0) {
/*
* Clean up the partially initialized bio-queue entirely and indicate that
* Clean up the partially initialized bio-queue entirely and indicate that
* initialization failed.
*/
- vdo_free_int_map(uds_forget(bio_queue_data->map));
+ vdo_int_map_free(uds_forget(bio_queue_data->map));
uds_log_error("bio queue initialization failed %d", result);
vdo_cleanup_io_submitter(io_submitter);
vdo_free_io_submitter(io_submitter);
io_submitter->num_bio_queues_used--;
/* vdo_destroy() will free the work queue, so just give up our reference to it. */
uds_forget(io_submitter->bio_queue_data[i].queue);
- vdo_free_int_map(uds_forget(io_submitter->bio_queue_data[i].map));
+ vdo_int_map_free(uds_forget(io_submitter->bio_queue_data[i].map));
}
uds_free(io_submitter);
}
struct logical_zone *zone = &zones->zones[zone_number];
zone_count_t allocation_zone_number;
- result = vdo_make_int_map(VDO_LOCK_MAP_CAPACITY, 0, &zone->lbn_operations);
+ result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->lbn_operations);
if (result != VDO_SUCCESS)
return result;
uds_free(uds_forget(zones->manager));
for (index = 0; index < zones->zone_count; index++)
- vdo_free_int_map(uds_forget(zones->zones[index].lbn_operations));
+ vdo_int_map_free(uds_forget(zones->zones[index].lbn_operations));
uds_free(zones);
}
zone_count_t zone_number = zones->zone_count;
struct physical_zone *zone = &zones->zones[zone_number];
- result = vdo_make_int_map(VDO_LOCK_MAP_CAPACITY, 0, &zone->pbn_operations);
+ result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->pbn_operations);
if (result != VDO_SUCCESS)
return result;
result = make_pbn_lock_pool(LOCK_POOL_CAPACITY, &zone->lock_pool);
if (result != VDO_SUCCESS) {
- vdo_free_int_map(zone->pbn_operations);
+ vdo_int_map_free(zone->pbn_operations);
return result;
}
result = vdo_make_default_thread(vdo, zone->thread_id);
if (result != VDO_SUCCESS) {
free_pbn_lock_pool(uds_forget(zone->lock_pool));
- vdo_free_int_map(zone->pbn_operations);
+ vdo_int_map_free(zone->pbn_operations);
return result;
}
return result;
struct physical_zone *zone = &zones->zones[index];
free_pbn_lock_pool(uds_forget(zone->lock_pool));
- vdo_free_int_map(uds_forget(zone->pbn_operations));
+ vdo_int_map_free(uds_forget(zone->pbn_operations));
}
uds_free(zones);