From: Bruce Johnston <bjohnsto@xxxxxxxxxx> Reviewed-by: Matthew Sakai <msakai@xxxxxxxxxx> Signed-off-by: Bruce Johnston <bjohnsto@xxxxxxxxxx> Signed-off-by: Matthew Sakai <msakai@xxxxxxxxxx> --- drivers/md/dm-vdo/block-map.c | 6 +++--- drivers/md/dm-vdo/dedupe.c | 2 +- drivers/md/dm-vdo/int-map.c | 13 ++----------- drivers/md/dm-vdo/int-map.h | 3 +-- drivers/md/dm-vdo/io-submitter.c | 2 +- drivers/md/dm-vdo/logical-zone.c | 2 +- drivers/md/dm-vdo/physical-zone.c | 2 +- 7 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c index 953819943cd3..f9f68e8d4b0c 100644 --- a/drivers/md/dm-vdo/block-map.c +++ b/drivers/md/dm-vdo/block-map.c @@ -232,7 +232,7 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache) if (result != UDS_SUCCESS) return result; - result = vdo_int_map_create(cache->page_count, 0, &cache->page_map); + result = vdo_int_map_create(cache->page_count, &cache->page_map); if (result != UDS_SUCCESS) return result; @@ -1347,7 +1347,7 @@ int vdo_invalidate_page_cache(struct vdo_page_cache *cache) /* Reset the page map by re-allocating it. */ vdo_int_map_free(uds_forget(cache->page_map)); - return vdo_int_map_create(cache->page_count, 0, &cache->page_map); + return vdo_int_map_create(cache->page_count, &cache->page_map); } /** @@ -2751,7 +2751,7 @@ static int __must_check initialize_block_map_zone(struct block_map *map, INIT_LIST_HEAD(&zone->dirty_lists->eras[i][VDO_CACHE_PAGE]); } - result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->loading_pages); + result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, &zone->loading_pages); if (result != VDO_SUCCESS) return result; diff --git a/drivers/md/dm-vdo/dedupe.c b/drivers/md/dm-vdo/dedupe.c index b40ba499303f..dd3ee8e46b61 100644 --- a/drivers/md/dm-vdo/dedupe.c +++ b/drivers/md/dm-vdo/dedupe.c @@ -2405,7 +2405,7 @@ static int __must_check initialize_zone(struct vdo *vdo, struct hash_zones *zone data_vio_count_t i; struct hash_zone *zone = &zones->zones[zone_number]; - result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, + result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, &zone->hash_lock_map); if (result != VDO_SUCCESS) return result; diff --git a/drivers/md/dm-vdo/int-map.c b/drivers/md/dm-vdo/int-map.c index 94f13df7a2e1..99ccbb1339c6 100644 --- a/drivers/md/dm-vdo/int-map.c +++ b/drivers/md/dm-vdo/int-map.c @@ -174,25 +174,16 @@ static int allocate_buckets(struct int_map *map, size_t capacity) * 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 - * range 50 to 90, with zero telling the map to use its own default). * @map_ptr: Output, a pointer to hold the new int_map. * * Return: UDS_SUCCESS or an error code. */ -int vdo_int_map_create(size_t initial_capacity, unsigned int initial_load, - struct int_map **map_ptr) +int vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr) { struct int_map *map; int result; size_t capacity; - /* Use the default initial load if the caller did not specify one. */ - if (initial_load == 0) - initial_load = DEFAULT_LOAD; - if (initial_load > 100) - return UDS_INVALID_ARGUMENT; - result = uds_allocate(1, struct int_map, "struct int_map", &map); if (result != UDS_SUCCESS) return result; @@ -204,7 +195,7 @@ int vdo_int_map_create(size_t initial_capacity, unsigned int initial_load, * Scale up the capacity by the specified initial load factor. (i.e to hold 1000 entries at * 80% load we need a capacity of 1250) */ - capacity = capacity * 100 / initial_load; + capacity = capacity * 100 / DEFAULT_LOAD; result = allocate_buckets(map, capacity); if (result != UDS_SUCCESS) { diff --git a/drivers/md/dm-vdo/int-map.h b/drivers/md/dm-vdo/int-map.h index edafb7569f51..1858ad799887 100644 --- a/drivers/md/dm-vdo/int-map.h +++ b/drivers/md/dm-vdo/int-map.h @@ -23,8 +23,7 @@ struct int_map; -int __must_check vdo_int_map_create(size_t initial_capacity, unsigned int initial_load, - struct int_map **map_ptr); +int __must_check vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr); void vdo_int_map_free(struct int_map *map); diff --git a/drivers/md/dm-vdo/io-submitter.c b/drivers/md/dm-vdo/io-submitter.c index 9471b6caabe6..74f33a3ddce5 100644 --- a/drivers/md/dm-vdo/io-submitter.c +++ b/drivers/md/dm-vdo/io-submitter.c @@ -401,7 +401,7 @@ int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_inter * 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_int_map_create(max_requests_active * 2, 0, + result = vdo_int_map_create(max_requests_active * 2, &bio_queue_data->map); if (result != 0) { /* diff --git a/drivers/md/dm-vdo/logical-zone.c b/drivers/md/dm-vdo/logical-zone.c index df69fb68db3d..cfbf1701ca84 100644 --- a/drivers/md/dm-vdo/logical-zone.c +++ b/drivers/md/dm-vdo/logical-zone.c @@ -57,7 +57,7 @@ static int initialize_zone(struct logical_zones *zones, zone_count_t zone_number struct logical_zone *zone = &zones->zones[zone_number]; zone_count_t allocation_zone_number; - result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->lbn_operations); + result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, &zone->lbn_operations); if (result != VDO_SUCCESS) return result; diff --git a/drivers/md/dm-vdo/physical-zone.c b/drivers/md/dm-vdo/physical-zone.c index 8ecc80ecbb53..3bcf6f1ba77f 100644 --- a/drivers/md/dm-vdo/physical-zone.c +++ b/drivers/md/dm-vdo/physical-zone.c @@ -330,7 +330,7 @@ static int initialize_zone(struct vdo *vdo, struct physical_zones *zones) zone_count_t zone_number = zones->zone_count; struct physical_zone *zone = &zones->zones[zone_number]; - result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, 0, &zone->pbn_operations); + result = vdo_int_map_create(VDO_LOCK_MAP_CAPACITY, &zone->pbn_operations); if (result != VDO_SUCCESS) return result; -- 2.42.0