Commit 6c43cf24 authored by Mike Snitzer's avatar Mike Snitzer

dm vdo int-map: return VDO_SUCCESS on success

Update all callers to check for VDO_SUCCESS (most already did).
Also fix whitespace for update_mapping() parameters.
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent 2de70388
...@@ -231,7 +231,7 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache) ...@@ -231,7 +231,7 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)
return result; return result;
result = vdo_int_map_create(cache->page_count, &cache->page_map); result = vdo_int_map_create(cache->page_count, &cache->page_map);
if (result != UDS_SUCCESS) if (result != VDO_SUCCESS)
return result; return result;
return initialize_info(cache); return initialize_info(cache);
...@@ -390,7 +390,7 @@ static int __must_check set_info_pbn(struct page_info *info, physical_block_numb ...@@ -390,7 +390,7 @@ static int __must_check set_info_pbn(struct page_info *info, physical_block_numb
if (pbn != NO_PAGE) { if (pbn != NO_PAGE) {
result = vdo_int_map_put(cache->page_map, pbn, info, true, NULL); result = vdo_int_map_put(cache->page_map, pbn, info, true, NULL);
if (result != UDS_SUCCESS) if (result != VDO_SUCCESS)
return result; return result;
} }
return VDO_SUCCESS; return VDO_SUCCESS;
......
...@@ -397,7 +397,7 @@ static int resize_buckets(struct int_map *map) ...@@ -397,7 +397,7 @@ static int resize_buckets(struct int_map *map)
continue; continue;
result = vdo_int_map_put(map, entry->key, entry->value, true, NULL); result = vdo_int_map_put(map, entry->key, entry->value, true, NULL);
if (result != UDS_SUCCESS) { if (result != VDO_SUCCESS) {
/* Destroy the new partial map and restore the map from the stack. */ /* Destroy the new partial map and restore the map from the stack. */
vdo_free(vdo_forget(map->buckets)); vdo_free(vdo_forget(map->buckets));
*map = old_map; *map = old_map;
...@@ -525,12 +525,8 @@ static struct bucket *move_empty_bucket(struct int_map *map __always_unused, ...@@ -525,12 +525,8 @@ static struct bucket *move_empty_bucket(struct int_map *map __always_unused,
* *
* Return: true if the map contains a mapping for the key, false if it does not. * Return: true if the map contains a mapping for the key, false if it does not.
*/ */
static bool update_mapping(struct int_map *map, static bool update_mapping(struct int_map *map, struct bucket *neighborhood,
struct bucket *neighborhood, u64 key, void *new_value, bool update, void **old_value_ptr)
u64 key,
void *new_value,
bool update,
void **old_value_ptr)
{ {
struct bucket *bucket = search_hop_list(map, neighborhood, key, NULL); struct bucket *bucket = search_hop_list(map, neighborhood, key, NULL);
...@@ -609,15 +605,15 @@ static struct bucket *find_or_make_vacancy(struct int_map *map, ...@@ -609,15 +605,15 @@ static struct bucket *find_or_make_vacancy(struct int_map *map,
* update is true. In either case the old value is returned. If the map does not already contain a * update is true. In either case the old value is returned. If the map does not already contain a
* value for the specified key, the new value is added regardless of the value of update. * value for the specified key, the new value is added regardless of the value of update.
* *
* Return: UDS_SUCCESS or an error code. * Return: VDO_SUCCESS or an error code.
*/ */
int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update, int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
void **old_value_ptr) void **old_value_ptr)
{ {
struct bucket *neighborhood, *bucket; struct bucket *neighborhood, *bucket;
if (new_value == NULL) if (unlikely(new_value == NULL))
return UDS_INVALID_ARGUMENT; return -EINVAL;
/* /*
* Select the bucket at the start of the neighborhood that must contain any entry for the * Select the bucket at the start of the neighborhood that must contain any entry for the
...@@ -630,7 +626,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update, ...@@ -630,7 +626,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
* optionally update it, returning the old value. * optionally update it, returning the old value.
*/ */
if (update_mapping(map, neighborhood, key, new_value, update, old_value_ptr)) if (update_mapping(map, neighborhood, key, new_value, update, old_value_ptr))
return UDS_SUCCESS; return VDO_SUCCESS;
/* /*
* Find an empty bucket in the desired neighborhood for the new entry or re-arrange entries * Find an empty bucket in the desired neighborhood for the new entry or re-arrange entries
...@@ -666,7 +662,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update, ...@@ -666,7 +662,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
/* There was no existing entry, so there was no old value to be returned. */ /* There was no existing entry, so there was no old value to be returned. */
if (old_value_ptr != NULL) if (old_value_ptr != NULL)
*old_value_ptr = NULL; *old_value_ptr = NULL;
return UDS_SUCCESS; return VDO_SUCCESS;
} }
/** /**
......
...@@ -300,7 +300,7 @@ static bool try_bio_map_merge(struct vio *vio) ...@@ -300,7 +300,7 @@ static bool try_bio_map_merge(struct vio *vio)
mutex_unlock(&bio_queue_data->lock); mutex_unlock(&bio_queue_data->lock);
/* We don't care about failure of int_map_put in this case. */ /* We don't care about failure of int_map_put in this case. */
ASSERT_LOG_ONLY(result == UDS_SUCCESS, "bio map insertion succeeds"); ASSERT_LOG_ONLY(result == VDO_SUCCESS, "bio map insertion succeeds");
return merged; return merged;
} }
...@@ -403,7 +403,7 @@ int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_inter ...@@ -403,7 +403,7 @@ int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_inter
*/ */
result = vdo_int_map_create(max_requests_active * 2, result = vdo_int_map_create(max_requests_active * 2,
&bio_queue_data->map); &bio_queue_data->map);
if (result != 0) { if (result != VDO_SUCCESS) {
/* /*
* Clean up the partially initialized bio-queue entirely and indicate that * Clean up the partially initialized bio-queue entirely and indicate that
* initialization failed. * initialization failed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment