Skip to content

Commit 6c43cf2

Browse files
author
Mike Snitzer
committed
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: Mike Snitzer <[email protected]> Signed-off-by: Matthew Sakai <[email protected]>
1 parent 2de7038 commit 6c43cf2

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

drivers/md/dm-vdo/block-map.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)
231231
return result;
232232

233233
result = vdo_int_map_create(cache->page_count, &cache->page_map);
234-
if (result != UDS_SUCCESS)
234+
if (result != VDO_SUCCESS)
235235
return result;
236236

237237
return initialize_info(cache);
@@ -390,7 +390,7 @@ static int __must_check set_info_pbn(struct page_info *info, physical_block_numb
390390

391391
if (pbn != NO_PAGE) {
392392
result = vdo_int_map_put(cache->page_map, pbn, info, true, NULL);
393-
if (result != UDS_SUCCESS)
393+
if (result != VDO_SUCCESS)
394394
return result;
395395
}
396396
return VDO_SUCCESS;

drivers/md/dm-vdo/int-map.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static int resize_buckets(struct int_map *map)
397397
continue;
398398

399399
result = vdo_int_map_put(map, entry->key, entry->value, true, NULL);
400-
if (result != UDS_SUCCESS) {
400+
if (result != VDO_SUCCESS) {
401401
/* Destroy the new partial map and restore the map from the stack. */
402402
vdo_free(vdo_forget(map->buckets));
403403
*map = old_map;
@@ -525,12 +525,8 @@ static struct bucket *move_empty_bucket(struct int_map *map __always_unused,
525525
*
526526
* Return: true if the map contains a mapping for the key, false if it does not.
527527
*/
528-
static bool update_mapping(struct int_map *map,
529-
struct bucket *neighborhood,
530-
u64 key,
531-
void *new_value,
532-
bool update,
533-
void **old_value_ptr)
528+
static bool update_mapping(struct int_map *map, struct bucket *neighborhood,
529+
u64 key, void *new_value, bool update, void **old_value_ptr)
534530
{
535531
struct bucket *bucket = search_hop_list(map, neighborhood, key, NULL);
536532

@@ -609,15 +605,15 @@ static struct bucket *find_or_make_vacancy(struct int_map *map,
609605
* update is true. In either case the old value is returned. If the map does not already contain a
610606
* value for the specified key, the new value is added regardless of the value of update.
611607
*
612-
* Return: UDS_SUCCESS or an error code.
608+
* Return: VDO_SUCCESS or an error code.
613609
*/
614610
int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
615611
void **old_value_ptr)
616612
{
617613
struct bucket *neighborhood, *bucket;
618614

619-
if (new_value == NULL)
620-
return UDS_INVALID_ARGUMENT;
615+
if (unlikely(new_value == NULL))
616+
return -EINVAL;
621617

622618
/*
623619
* 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,
630626
* optionally update it, returning the old value.
631627
*/
632628
if (update_mapping(map, neighborhood, key, new_value, update, old_value_ptr))
633-
return UDS_SUCCESS;
629+
return VDO_SUCCESS;
634630

635631
/*
636632
* 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,
666662
/* There was no existing entry, so there was no old value to be returned. */
667663
if (old_value_ptr != NULL)
668664
*old_value_ptr = NULL;
669-
return UDS_SUCCESS;
665+
return VDO_SUCCESS;
670666
}
671667

672668
/**

drivers/md/dm-vdo/io-submitter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static bool try_bio_map_merge(struct vio *vio)
300300
mutex_unlock(&bio_queue_data->lock);
301301

302302
/* We don't care about failure of int_map_put in this case. */
303-
ASSERT_LOG_ONLY(result == UDS_SUCCESS, "bio map insertion succeeds");
303+
ASSERT_LOG_ONLY(result == VDO_SUCCESS, "bio map insertion succeeds");
304304
return merged;
305305
}
306306

@@ -403,7 +403,7 @@ int vdo_make_io_submitter(unsigned int thread_count, unsigned int rotation_inter
403403
*/
404404
result = vdo_int_map_create(max_requests_active * 2,
405405
&bio_queue_data->map);
406-
if (result != 0) {
406+
if (result != VDO_SUCCESS) {
407407
/*
408408
* Clean up the partially initialized bio-queue entirely and indicate that
409409
* initialization failed.

0 commit comments

Comments
 (0)