70
70
* it's crucial to keep the hop fields near the buckets that they use them so they'll tend to share
71
71
* cache lines.
72
72
*/
73
- struct __packed bucket {
73
+ struct bucket {
74
74
/**
75
75
* @first_hop: The biased offset of the first entry in the hop list of the neighborhood
76
76
* that hashes to this bucket.
@@ -82,7 +82,7 @@ struct __packed bucket {
82
82
u64 key ;
83
83
/** @value: The value stored in this bucket (NULL if empty). */
84
84
void * value ;
85
- };
85
+ } __packed ;
86
86
87
87
/**
88
88
* struct int_map - The concrete definition of the opaque int_map type.
@@ -310,7 +310,6 @@ static struct bucket *select_bucket(const struct int_map *map, u64 key)
310
310
/**
311
311
* search_hop_list() - Search the hop list associated with given hash bucket for a given search
312
312
* key.
313
- * @map: The map being searched.
314
313
* @bucket: The map bucket to search for the key.
315
314
* @key: The mapping key.
316
315
* @previous_ptr: Output. if not NULL, a pointer in which to store the bucket in the list preceding
@@ -321,9 +320,7 @@ static struct bucket *select_bucket(const struct int_map *map, u64 key)
321
320
*
322
321
* Return: An entry that matches the key, or NULL if not found.
323
322
*/
324
- static struct bucket * search_hop_list (struct int_map * map __always_unused ,
325
- struct bucket * bucket ,
326
- u64 key ,
323
+ static struct bucket * search_hop_list (struct bucket * bucket , u64 key ,
327
324
struct bucket * * previous_ptr )
328
325
{
329
326
struct bucket * previous = NULL ;
@@ -357,7 +354,7 @@ static struct bucket *search_hop_list(struct int_map *map __always_unused,
357
354
*/
358
355
void * vdo_int_map_get (struct int_map * map , u64 key )
359
356
{
360
- struct bucket * match = search_hop_list (map , select_bucket (map , key ), key , NULL );
357
+ struct bucket * match = search_hop_list (select_bucket (map , key ), key , NULL );
361
358
362
359
return ((match != NULL ) ? match -> value : NULL );
363
360
}
@@ -443,7 +440,6 @@ find_empty_bucket(struct int_map *map, struct bucket *bucket, unsigned int max_p
443
440
444
441
/**
445
442
* move_empty_bucket() - Move an empty bucket closer to the start of the bucket array.
446
- * @map: The map containing the bucket.
447
443
* @hole: The empty bucket to fill with an entry that precedes it in one of its enclosing
448
444
* neighborhoods.
449
445
*
@@ -454,8 +450,7 @@ find_empty_bucket(struct int_map *map, struct bucket *bucket, unsigned int max_p
454
450
* Return: The bucket that was vacated by moving its entry to the provided hole, or NULL if no
455
451
* entry could be moved.
456
452
*/
457
- static struct bucket * move_empty_bucket (struct int_map * map __always_unused ,
458
- struct bucket * hole )
453
+ static struct bucket * move_empty_bucket (struct bucket * hole )
459
454
{
460
455
/*
461
456
* Examine every neighborhood that the empty bucket is part of, starting with the one in
@@ -516,7 +511,6 @@ static struct bucket *move_empty_bucket(struct int_map *map __always_unused,
516
511
/**
517
512
* update_mapping() - Find and update any existing mapping for a given key, returning the value
518
513
* associated with the key in the provided pointer.
519
- * @map: The int_map to attempt to modify.
520
514
* @neighborhood: The first bucket in the neighborhood that would contain the search key
521
515
* @key: The key with which to associate the new value.
522
516
* @new_value: The value to be associated with the key.
@@ -525,10 +519,10 @@ static struct bucket *move_empty_bucket(struct int_map *map __always_unused,
525
519
*
526
520
* Return: true if the map contains a mapping for the key, false if it does not.
527
521
*/
528
- static bool update_mapping (struct int_map * map , struct bucket * neighborhood ,
529
- u64 key , void * new_value , bool update , void * * old_value_ptr )
522
+ static bool update_mapping (struct bucket * neighborhood , u64 key , void * new_value ,
523
+ bool update , void * * old_value_ptr )
530
524
{
531
- struct bucket * bucket = search_hop_list (map , neighborhood , key , NULL );
525
+ struct bucket * bucket = search_hop_list (neighborhood , key , NULL );
532
526
533
527
if (bucket == NULL ) {
534
528
/* There is no bucket containing the key in the neighborhood. */
@@ -584,7 +578,7 @@ static struct bucket *find_or_make_vacancy(struct int_map *map,
584
578
* The nearest empty bucket isn't within the neighborhood that must contain the new
585
579
* entry, so try to swap it with bucket that is closer.
586
580
*/
587
- hole = move_empty_bucket (map , hole );
581
+ hole = move_empty_bucket (hole );
588
582
}
589
583
590
584
return NULL ;
@@ -625,7 +619,7 @@ int vdo_int_map_put(struct int_map *map, u64 key, void *new_value, bool update,
625
619
* Check whether the neighborhood already contains an entry for the key, in which case we
626
620
* optionally update it, returning the old value.
627
621
*/
628
- if (update_mapping (map , neighborhood , key , new_value , update , old_value_ptr ))
622
+ if (update_mapping (neighborhood , key , new_value , update , old_value_ptr ))
629
623
return VDO_SUCCESS ;
630
624
631
625
/*
@@ -679,7 +673,7 @@ void *vdo_int_map_remove(struct int_map *map, u64 key)
679
673
/* Select the bucket to search and search it for an existing entry. */
680
674
struct bucket * bucket = select_bucket (map , key );
681
675
struct bucket * previous ;
682
- struct bucket * victim = search_hop_list (map , bucket , key , & previous );
676
+ struct bucket * victim = search_hop_list (bucket , key , & previous );
683
677
684
678
if (victim == NULL ) {
685
679
/* There is no matching entry to remove. */
0 commit comments