]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm vdo: remove redundant TYPE argument from vdo_allocate macro
authorKen Raeburn <raeburn@redhat.com>
Fri, 27 Feb 2026 01:12:07 +0000 (20:12 -0500)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 2 Mar 2026 16:03:28 +0000 (17:03 +0100)
We can infer the type needed from the supplied pointer argument. A
couple invocation sites needed fixing to supply the proper type of
pointer.

Use overflow.h's size_mul, and we can remove the __vdo_do_allocation
wrapper which did the same overflow check.

Signed-off-by: Ken Raeburn <raeburn@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
32 files changed:
drivers/md/dm-vdo/action-manager.c
drivers/md/dm-vdo/block-map.c
drivers/md/dm-vdo/dedupe.c
drivers/md/dm-vdo/dm-vdo-target.c
drivers/md/dm-vdo/encodings.c
drivers/md/dm-vdo/flush.c
drivers/md/dm-vdo/funnel-queue.c
drivers/md/dm-vdo/funnel-workqueue.c
drivers/md/dm-vdo/indexer/chapter-index.c
drivers/md/dm-vdo/indexer/config.c
drivers/md/dm-vdo/indexer/delta-index.c
drivers/md/dm-vdo/indexer/funnel-requestqueue.c
drivers/md/dm-vdo/indexer/geometry.c
drivers/md/dm-vdo/indexer/index-layout.c
drivers/md/dm-vdo/indexer/index-page-map.c
drivers/md/dm-vdo/indexer/index-session.c
drivers/md/dm-vdo/indexer/index.c
drivers/md/dm-vdo/indexer/io-factory.c
drivers/md/dm-vdo/indexer/sparse-cache.c
drivers/md/dm-vdo/indexer/volume-index.c
drivers/md/dm-vdo/indexer/volume.c
drivers/md/dm-vdo/int-map.c
drivers/md/dm-vdo/memory-alloc.c
drivers/md/dm-vdo/memory-alloc.h
drivers/md/dm-vdo/message-stats.c
drivers/md/dm-vdo/packer.c
drivers/md/dm-vdo/recovery-journal.c
drivers/md/dm-vdo/repair.c
drivers/md/dm-vdo/slab-depot.c
drivers/md/dm-vdo/thread-utils.c
drivers/md/dm-vdo/vdo.c
drivers/md/dm-vdo/vio.c

index e3bba0b28aad87e20050b7fe7716d759f6a9ca0c..b8a3977b815d96c8d2558b826698b567a9ed230b 100644 (file)
@@ -107,7 +107,7 @@ int vdo_make_action_manager(zone_count_t zones,
                            struct action_manager **manager_ptr)
 {
        struct action_manager *manager;
-       int result = vdo_allocate(1, struct action_manager, __func__, &manager);
+       int result = vdo_allocate(1, __func__, &manager);
 
        if (result != VDO_SUCCESS)
                return result;
index 25eda82a96359b15f5fe0b6c671e8273e595d973..5ffc360540ed1e97b7ee2996c7deb19341673873 100644 (file)
@@ -221,8 +221,7 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)
        u64 size = cache->page_count * (u64) VDO_BLOCK_SIZE;
        int result;
 
-       result = vdo_allocate(cache->page_count, struct page_info, "page infos",
-                             &cache->infos);
+       result = vdo_allocate(cache->page_count, "page infos", &cache->infos);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -2364,18 +2363,15 @@ static int make_segment(struct forest *old_forest, block_count_t new_pages,
 
        forest->segments = index + 1;
 
-       result = vdo_allocate(forest->segments, struct boundary,
-                             "forest boundary array", &forest->boundaries);
+       result = vdo_allocate(forest->segments, "forest boundary array", &forest->boundaries);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(forest->segments, struct tree_page *,
-                             "forest page pointers", &forest->pages);
+       result = vdo_allocate(forest->segments, "forest page pointers", &forest->pages);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(new_pages, struct tree_page,
-                             "new forest pages", &forest->pages[index]);
+       result = vdo_allocate(new_pages, "new forest pages", &forest->pages[index]);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -2400,9 +2396,7 @@ static int make_segment(struct forest *old_forest, block_count_t new_pages,
                struct block_map_tree *tree = &(forest->trees[root]);
                height_t height;
 
-               int result = vdo_allocate(forest->segments,
-                                         struct block_map_tree_segment,
-                                         "tree root segments", &tree->segments);
+               result = vdo_allocate(forest->segments, "tree root segments", &tree->segments);
                if (result != VDO_SUCCESS)
                        return result;
 
index 36e9f123602539f5e84083637fa0f80b0cfe88cb..4e0fefd077d07720c96dddf02b518ce8d34e98fa 100644 (file)
@@ -2364,8 +2364,7 @@ static int __must_check initialize_zone(struct vdo *vdo, struct hash_zones *zone
        vdo_set_completion_callback(&zone->completion, timeout_index_operations_callback,
                                    zone->thread_id);
        INIT_LIST_HEAD(&zone->lock_pool);
-       result = vdo_allocate(LOCK_POOL_CAPACITY, struct hash_lock, "hash_lock array",
-                             &zone->lock_array);
+       result = vdo_allocate(LOCK_POOL_CAPACITY, "hash_lock array", &zone->lock_array);
        if (result != VDO_SUCCESS)
                return result;
 
index 6af40d40f2550aaf075f0ec9cbf0d15dd041b2c5..7eb676e58ed530ca922e6f258f580d0d8992ee60 100644 (file)
@@ -273,8 +273,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
                        substring_count++;
        }
 
-       result = vdo_allocate(substring_count + 1, char *, "string-splitting array",
-                             &substrings);
+       result = vdo_allocate(substring_count + 1, "string-splitting array", &substrings);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -282,7 +281,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
                if (*s == separator) {
                        ptrdiff_t length = s - string;
 
-                       result = vdo_allocate(length + 1, char, "split string",
+                       result = vdo_allocate(length + 1, "split string",
                                              &substrings[current_substring]);
                        if (result != VDO_SUCCESS) {
                                free_string_array(substrings);
@@ -303,8 +302,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
        BUG_ON(current_substring != (substring_count - 1));
        length = strlen(string);
 
-       result = vdo_allocate(length + 1, char, "split string",
-                             &substrings[current_substring]);
+       result = vdo_allocate(length + 1, "split string", &substrings[current_substring]);
        if (result != VDO_SUCCESS) {
                free_string_array(substrings);
                return result;
@@ -332,7 +330,7 @@ static int join_strings(char **substring_array, size_t array_length, char separa
        for (i = 0; (i < array_length) && (substring_array[i] != NULL); i++)
                string_length += strlen(substring_array[i]) + 1;
 
-       result = vdo_allocate(string_length, char, __func__, &output);
+       result = vdo_allocate(string_length, __func__, &output);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -726,7 +724,7 @@ static int parse_device_config(int argc, char **argv, struct dm_target *ti,
                return VDO_BAD_CONFIGURATION;
        }
 
-       result = vdo_allocate(1, struct device_config, "device_config", &config);
+       result = vdo_allocate(1, "device_config", &config);
        if (result != VDO_SUCCESS) {
                handle_parse_error(config, error_ptr,
                                   "Could not allocate config structure");
index bd60f4b3a0d0efcea6900b3b9902725351849a6a..ec98c539701e3b7dd5558aca1c74d5da6cf0dca8 100644 (file)
@@ -798,7 +798,7 @@ static int allocate_partition(struct layout *layout, u8 id,
        struct partition *partition;
        int result;
 
-       result = vdo_allocate(1, struct partition, __func__, &partition);
+       result = vdo_allocate(1, __func__, &partition);
        if (result != VDO_SUCCESS)
                return result;
 
index 82a259ef16012b7fc42ca0f2c609fae9d18822f3..6c1610ba91b6197973ed734fc29bff5f2e05a29a 100644 (file)
@@ -105,7 +105,7 @@ static void *allocate_flush(gfp_t gfp_mask, void *pool_data)
        if ((gfp_mask & GFP_NOWAIT) == GFP_NOWAIT) {
                flush = vdo_allocate_memory_nowait(sizeof(struct vdo_flush), __func__);
        } else {
-               int result = vdo_allocate(1, struct vdo_flush, __func__, &flush);
+               int result = vdo_allocate(1, __func__, &flush);
 
                if (result != VDO_SUCCESS)
                        vdo_log_error_strerror(result, "failed to allocate spare flush");
@@ -134,7 +134,7 @@ static void free_flush(void *element, void *pool_data __always_unused)
  */
 int vdo_make_flusher(struct vdo *vdo)
 {
-       int result = vdo_allocate(1, struct flusher, __func__, &vdo->flusher);
+       int result = vdo_allocate(1, __func__, &vdo->flusher);
 
        if (result != VDO_SUCCESS)
                return result;
index a63b2f2bfd7de9e6e6d5298e440ba37db5a30823..7011963c90734b86aa4c8797dc9a5e4841eb20e7 100644 (file)
@@ -14,7 +14,7 @@ int vdo_make_funnel_queue(struct funnel_queue **queue_ptr)
        int result;
        struct funnel_queue *queue;
 
-       result = vdo_allocate(1, struct funnel_queue, "funnel queue", &queue);
+       result = vdo_allocate(1, "funnel queue", &queue);
        if (result != VDO_SUCCESS)
                return result;
 
index 8a79b33b8b090482cacd24b3b67c4986b7fc57d0..62d300f70de9443ca0c9958078545548cfc275b0 100644 (file)
@@ -322,7 +322,7 @@ static int make_simple_work_queue(const char *thread_name_prefix, const char *na
                            "queue priority count %u within limit %u", type->max_priority,
                            VDO_WORK_Q_MAX_PRIORITY);
 
-       result = vdo_allocate(1, struct simple_work_queue, "simple work queue", &queue);
+       result = vdo_allocate(1, "simple work queue", &queue);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -405,13 +405,11 @@ int vdo_make_work_queue(const char *thread_name_prefix, const char *name,
                return result;
        }
 
-       result = vdo_allocate(1, struct round_robin_work_queue, "round-robin work queue",
-                             &queue);
+       result = vdo_allocate(1, "round-robin work queue", &queue);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(thread_count, struct simple_work_queue *,
-                             "subordinate work queues", &queue->service_queues);
+       result = vdo_allocate(thread_count, "subordinate work queues", &queue->service_queues);
        if (result != VDO_SUCCESS) {
                vdo_free(queue);
                return result;
index fb1db41c794b33cd6e9826b6e6eb770448faa7ea..bb3b0ab5d50dc509eeb707dc165d46bf0acbb931 100644 (file)
@@ -20,7 +20,7 @@ int uds_make_open_chapter_index(struct open_chapter_index **chapter_index,
        size_t memory_size;
        struct open_chapter_index *index;
 
-       result = vdo_allocate(1, struct open_chapter_index, "open chapter index", &index);
+       result = vdo_allocate(1, "open chapter index", &index);
        if (result != VDO_SUCCESS)
                return result;
 
index 5532371b952fec7f07c01c10fdec9938c6de7a2e..4a2cc66cfd60a705f264087b98fabbc3750355a4 100644 (file)
@@ -325,7 +325,7 @@ int uds_make_configuration(const struct uds_parameters *params,
        if (result != UDS_SUCCESS)
                return result;
 
-       result = vdo_allocate(1, struct uds_configuration, __func__, &config);
+       result = vdo_allocate(1, __func__, &config);
        if (result != VDO_SUCCESS)
                return result;
 
index 0ac2443f0df363cf7897f40c1dbc23d074d741b7..b288749067dee8b5182931161f621422e083ead3 100644 (file)
@@ -311,18 +311,16 @@ static int initialize_delta_zone(struct delta_zone *delta_zone, size_t size,
 {
        int result;
 
-       result = vdo_allocate(size, u8, "delta list", &delta_zone->memory);
+       result = vdo_allocate(size, "delta list", &delta_zone->memory);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(list_count + 2, u64, "delta list temp",
-                             &delta_zone->new_offsets);
+       result = vdo_allocate(list_count + 2, "delta list temp", &delta_zone->new_offsets);
        if (result != VDO_SUCCESS)
                return result;
 
        /* Allocate the delta lists. */
-       result = vdo_allocate(list_count + 2, struct delta_list, "delta lists",
-                             &delta_zone->delta_lists);
+       result = vdo_allocate(list_count + 2, "delta lists", &delta_zone->delta_lists);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -352,8 +350,7 @@ int uds_initialize_delta_index(struct delta_index *delta_index, unsigned int zon
        unsigned int z;
        size_t zone_memory;
 
-       result = vdo_allocate(zone_count, struct delta_zone, "Delta Index Zones",
-                             &delta_index->delta_zones);
+       result = vdo_allocate(zone_count, "Delta Index Zones", &delta_index->delta_zones);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1047,7 +1044,7 @@ int uds_finish_restoring_delta_index(struct delta_index *delta_index,
        unsigned int z;
        u8 *data;
 
-       result = vdo_allocate(DELTA_LIST_MAX_BYTE_COUNT, u8, __func__, &data);
+       result = vdo_allocate(DELTA_LIST_MAX_BYTE_COUNT, __func__, &data);
        if (result != VDO_SUCCESS)
                return result;
 
index 1a5735375ddc06732512852a1990df635a5f4491..03797cf87b914bb90bf816a48df9fb5aa2c8b4ce 100644 (file)
@@ -198,7 +198,7 @@ int uds_make_request_queue(const char *queue_name,
        int result;
        struct uds_request_queue *queue;
 
-       result = vdo_allocate(1, struct uds_request_queue, __func__, &queue);
+       result = vdo_allocate(1, __func__, &queue);
        if (result != VDO_SUCCESS)
                return result;
 
index c0575612e820ba2e1570b947c64af718cd0cfe2f..49f122a223d5192556b0f4adf716065949c280eb 100644 (file)
@@ -61,7 +61,7 @@ int uds_make_index_geometry(size_t bytes_per_page, u32 record_pages_per_chapter,
        int result;
        struct index_geometry *geometry;
 
-       result = vdo_allocate(1, struct index_geometry, "geometry", &geometry);
+       result = vdo_allocate(1, "geometry", &geometry);
        if (result != VDO_SUCCESS)
                return result;
 
index 76bcc0ae76cc918438664250bfdb00428c5b71bb..7a1209b21c03c0b3490aaae4593851b716e24c5b 100644 (file)
@@ -519,7 +519,7 @@ static int __must_check write_index_save_header(struct index_save_layout *isl,
        u8 *buffer;
        size_t offset = 0;
 
-       result = vdo_allocate(table->encoded_size, u8, "index save data", &buffer);
+       result = vdo_allocate(table->encoded_size, "index save data", &buffer);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -688,7 +688,7 @@ static int __must_check write_layout_header(struct index_layout *layout,
        u8 *buffer;
        size_t offset = 0;
 
-       result = vdo_allocate(table->encoded_size, u8, "layout data", &buffer);
+       result = vdo_allocate(table->encoded_size, "layout data", &buffer);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -778,8 +778,7 @@ static int create_index_layout(struct index_layout *layout, struct uds_configura
        if (result != UDS_SUCCESS)
                return result;
 
-       result = vdo_allocate(sizes.save_count, struct index_save_layout, __func__,
-                             &layout->index.saves);
+       result = vdo_allocate(sizes.save_count, __func__, &layout->index.saves);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1174,7 +1173,7 @@ static int __must_check read_super_block_data(struct buffered_reader *reader,
        u8 *buffer;
        size_t offset = 0;
 
-       result = vdo_allocate(saved_size, u8, "super block data", &buffer);
+       result = vdo_allocate(saved_size, "super block data", &buffer);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1308,8 +1307,7 @@ static int __must_check reconstitute_layout(struct index_layout *layout,
        int result;
        u64 next_block = first_block;
 
-       result = vdo_allocate(layout->super.max_saves, struct index_save_layout,
-                             __func__, &layout->index.saves);
+       result = vdo_allocate(layout->super.max_saves, __func__, &layout->index.saves);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1672,7 +1670,7 @@ int uds_make_index_layout(struct uds_configuration *config, bool new_layout,
        if (result != UDS_SUCCESS)
                return result;
 
-       result = vdo_allocate(1, struct index_layout, __func__, &layout);
+       result = vdo_allocate(1, __func__, &layout);
        if (result != VDO_SUCCESS)
                return result;
 
index 00b44e07d0c1f141e9fd46871f6ac883b14648fe..1d45d466d07f1ce77e927c74d3adcd8314f8aeb9 100644 (file)
@@ -38,13 +38,13 @@ int uds_make_index_page_map(const struct index_geometry *geometry,
        int result;
        struct index_page_map *map;
 
-       result = vdo_allocate(1, struct index_page_map, "page map", &map);
+       result = vdo_allocate(1, "page map", &map);
        if (result != VDO_SUCCESS)
                return result;
 
        map->geometry = geometry;
        map->entries_per_chapter = geometry->index_pages_per_chapter - 1;
-       result = vdo_allocate(get_entry_count(geometry), u16, "Index Page Map Entries",
+       result = vdo_allocate(get_entry_count(geometry), "Index Page Map Entries",
                              &map->entries);
        if (result != VDO_SUCCESS) {
                uds_free_index_page_map(map);
@@ -118,7 +118,7 @@ int uds_write_index_page_map(struct index_page_map *map, struct buffered_writer
        u64 saved_size = uds_compute_index_page_map_save_size(map->geometry);
        u32 i;
 
-       result = vdo_allocate(saved_size, u8, "page map data", &buffer);
+       result = vdo_allocate(saved_size, "page map data", &buffer);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -145,7 +145,7 @@ int uds_read_index_page_map(struct index_page_map *map, struct buffered_reader *
        u64 saved_size = uds_compute_index_page_map_save_size(map->geometry);
        u32 i;
 
-       result = vdo_allocate(saved_size, u8, "page map data", &buffer);
+       result = vdo_allocate(saved_size, "page map data", &buffer);
        if (result != VDO_SUCCESS)
                return result;
 
index aa575a24e0b2f9cba1b98d20aa8001396452df23..6c78070e1a055df7622e30ca295c5862ffa78827 100644 (file)
@@ -217,7 +217,7 @@ static int __must_check make_empty_index_session(struct uds_index_session **inde
        int result;
        struct uds_index_session *session;
 
-       result = vdo_allocate(1, struct uds_index_session, __func__, &session);
+       result = vdo_allocate(1, __func__, &session);
        if (result != VDO_SUCCESS)
                return result;
 
index d4724fe17bf1af02bf146456fa87f3370dc85710..793bd32c1179d315b36e9e8d4aaba203eb035095 100644 (file)
@@ -88,7 +88,7 @@ static int launch_zone_message(struct uds_zone_message message, unsigned int zon
        int result;
        struct uds_request *request;
 
-       result = vdo_allocate(1, struct uds_request, __func__, &request);
+       result = vdo_allocate(1, __func__, &request);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1121,7 +1121,7 @@ static int make_index_zone(struct uds_index *index, unsigned int zone_number)
        int result;
        struct index_zone *zone;
 
-       result = vdo_allocate(1, struct index_zone, "index zone", &zone);
+       result = vdo_allocate(1, "index zone", &zone);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1170,8 +1170,7 @@ int uds_make_index(struct uds_configuration *config, enum uds_open_index_type op
                return result;
        }
 
-       result = vdo_allocate(index->zone_count, struct index_zone *, "zones",
-                             &index->zones);
+       result = vdo_allocate(index->zone_count, "zones", &index->zones);
        if (result != VDO_SUCCESS) {
                uds_free_index(index);
                return result;
index 1bee9d63dc0a692734cc6908809534dcc45bb158..f428613720301629f11db12e209d316076932145 100644 (file)
@@ -64,7 +64,7 @@ int uds_make_io_factory(struct block_device *bdev, struct io_factory **factory_p
        int result;
        struct io_factory *factory;
 
-       result = vdo_allocate(1, struct io_factory, __func__, &factory);
+       result = vdo_allocate(1, __func__, &factory);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -144,7 +144,7 @@ int uds_make_buffered_reader(struct io_factory *factory, off_t offset, u64 block
        if (result != UDS_SUCCESS)
                return result;
 
-       result = vdo_allocate(1, struct buffered_reader, "buffered reader", &reader);
+       result = vdo_allocate(1, "buffered reader", &reader);
        if (result != VDO_SUCCESS) {
                dm_bufio_client_destroy(client);
                return result;
@@ -282,7 +282,7 @@ int uds_make_buffered_writer(struct io_factory *factory, off_t offset, u64 block
        if (result != UDS_SUCCESS)
                return result;
 
-       result = vdo_allocate(1, struct buffered_writer, "buffered writer", &writer);
+       result = vdo_allocate(1, "buffered writer", &writer);
        if (result != VDO_SUCCESS) {
                dm_bufio_client_destroy(client);
                return result;
index 28920167827c4198399f4ecc64de48d57155f397..eb62d3f018341ffbcc66de0dd1ed3a56adfda93f 100644 (file)
@@ -222,13 +222,12 @@ static int __must_check initialize_cached_chapter_index(struct cached_chapter_in
        chapter->virtual_chapter = NO_CHAPTER;
        chapter->index_pages_count = geometry->index_pages_per_chapter;
 
-       result = vdo_allocate(chapter->index_pages_count, struct delta_index_page,
-                             __func__, &chapter->index_pages);
+       result = vdo_allocate(chapter->index_pages_count, __func__, &chapter->index_pages);
        if (result != VDO_SUCCESS)
                return result;
 
-       return vdo_allocate(chapter->index_pages_count, struct dm_buffer *,
-                           "sparse index volume pages", &chapter->page_buffers);
+       return vdo_allocate(chapter->index_pages_count, "sparse index volume pages",
+                           &chapter->page_buffers);
 }
 
 static int __must_check make_search_list(struct sparse_cache *cache,
@@ -294,8 +293,7 @@ int uds_make_sparse_cache(const struct index_geometry *geometry, unsigned int ca
        }
 
        /* purge_search_list() needs some temporary lists for sorting. */
-       result = vdo_allocate(capacity * 2, struct cached_chapter_index *,
-                             "scratch entries", &cache->scratch_entries);
+       result = vdo_allocate(capacity * 2, "scratch entries", &cache->scratch_entries);
        if (result != VDO_SUCCESS)
                goto out;
 
index afb062e1f1fb4845d8060f0ddc0b377266e850c2..e78d2725ce8b6bdf6f087ae4b24ce36c8f52e0f9 100644 (file)
@@ -1211,13 +1211,12 @@ static int initialize_volume_sub_index(const struct uds_configuration *config,
                                  (zone_count * sizeof(struct volume_sub_index_zone)));
 
        /* The following arrays are initialized to all zeros. */
-       result = vdo_allocate(params.list_count, u64, "first chapter to flush",
+       result = vdo_allocate(params.list_count, "first chapter to flush",
                              &sub_index->flush_chapters);
        if (result != VDO_SUCCESS)
                return result;
 
-       return vdo_allocate(zone_count, struct volume_sub_index_zone,
-                           "volume index zones", &sub_index->zones);
+       return vdo_allocate(zone_count, "volume index zones", &sub_index->zones);
 }
 
 int uds_make_volume_index(const struct uds_configuration *config, u64 volume_nonce,
@@ -1228,7 +1227,7 @@ int uds_make_volume_index(const struct uds_configuration *config, u64 volume_non
        struct volume_index *volume_index;
        int result;
 
-       result = vdo_allocate(1, struct volume_index, "volume index", &volume_index);
+       result = vdo_allocate(1, "volume index", &volume_index);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1249,8 +1248,7 @@ int uds_make_volume_index(const struct uds_configuration *config, u64 volume_non
 
        volume_index->sparse_sample_rate = config->sparse_sample_rate;
 
-       result = vdo_allocate(config->zone_count, struct volume_index_zone,
-                             "volume index zones", &volume_index->zones);
+       result = vdo_allocate(config->zone_count, "volume index zones", &volume_index->zones);
        if (result != VDO_SUCCESS) {
                uds_free_volume_index(volume_index);
                return result;
index 425b3a74f4dbae21b0d05a34a16d39afc02b0978..af97c0cbeede423b32cd30f3d397fdbc079dccb2 100644 (file)
@@ -1509,23 +1509,21 @@ static int __must_check initialize_page_cache(struct page_cache *cache,
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(VOLUME_CACHE_MAX_QUEUED_READS, struct queued_read,
-                             "volume read queue", &cache->read_queue);
+       result = vdo_allocate(VOLUME_CACHE_MAX_QUEUED_READS, "volume read queue",
+                             &cache->read_queue);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(cache->zone_count, struct search_pending_counter,
-                             "Volume Cache Zones", &cache->search_pending_counters);
+       result = vdo_allocate(cache->zone_count, "Volume Cache Zones",
+                             &cache->search_pending_counters);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(cache->indexable_pages, u16, "page cache index",
-                             &cache->index);
+       result = vdo_allocate(cache->indexable_pages, "page cache index", &cache->index);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(cache->cache_slots, struct cached_page, "page cache cache",
-                             &cache->cache);
+       result = vdo_allocate(cache->cache_slots, "page cache cache", &cache->cache);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1548,7 +1546,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
        unsigned int reserved_buffers;
        int result;
 
-       result = vdo_allocate(1, struct volume, "volume", &volume);
+       result = vdo_allocate(1, "volume", &volume);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1585,8 +1583,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
                return result;
        }
 
-       result = vdo_allocate(geometry->records_per_page,
-                             const struct uds_volume_record *, "record pointers",
+       result = vdo_allocate(geometry->records_per_page, "record pointers",
                              &volume->record_pointers);
        if (result != VDO_SUCCESS) {
                uds_free_volume(volume);
@@ -1626,8 +1623,7 @@ int uds_make_volume(const struct uds_configuration *config, struct index_layout
        uds_init_cond(&volume->read_threads_read_done_cond);
        uds_init_cond(&volume->read_threads_cond);
 
-       result = vdo_allocate(config->read_threads, struct thread *, "reader threads",
-                             &volume->reader_threads);
+       result = vdo_allocate(config->read_threads, "reader threads", &volume->reader_threads);
        if (result != VDO_SUCCESS) {
                uds_free_volume(volume);
                return result;
index aeb690415dbd18abf42e1cbb881bbcee718129fa..28d8af1f9be224833757459e15cb969857bbdac5 100644 (file)
@@ -164,8 +164,7 @@ static int allocate_buckets(struct int_map *map, size_t capacity)
         * without have to wrap back around to element zero.
         */
        map->bucket_count = capacity + (NEIGHBORHOOD - 1);
-       return vdo_allocate(map->bucket_count, struct bucket,
-                           "struct int_map buckets", &map->buckets);
+       return vdo_allocate(map->bucket_count, "struct int_map buckets", &map->buckets);
 }
 
 /**
@@ -182,7 +181,7 @@ int vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr)
        int result;
        size_t capacity;
 
-       result = vdo_allocate(1, struct int_map, "struct int_map", &map);
+       result = vdo_allocate(1, "struct int_map", &map);
        if (result != VDO_SUCCESS)
                return result;
 
index 185f259c7245d1ab4bdb9e91ad7b6b9f5a9f4321..a7f07522110d9a6411e2e0b19c0a5243e9027657 100644 (file)
@@ -245,7 +245,7 @@ int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)
        } else {
                struct vmalloc_block_info *block;
 
-               if (vdo_allocate(1, struct vmalloc_block_info, __func__, &block) == VDO_SUCCESS) {
+               if (vdo_allocate(1, __func__, &block) == VDO_SUCCESS) {
                        /*
                         * It is possible for __vmalloc to fail to allocate memory because there
                         * are no pages available. A short sleep may allow the page reclaimer
@@ -341,6 +341,7 @@ int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w
                          void *new_ptr)
 {
        int result;
+       char *temp_ptr;
 
        if (size == 0) {
                vdo_free(ptr);
@@ -348,9 +349,10 @@ int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w
                return VDO_SUCCESS;
        }
 
-       result = vdo_allocate(size, char, what, new_ptr);
+       result = vdo_allocate(size, what, &temp_ptr);
        if (result != VDO_SUCCESS)
                return result;
+       *(void **) new_ptr = temp_ptr;
 
        if (ptr != NULL) {
                if (old_size < size)
@@ -368,7 +370,7 @@ int vdo_duplicate_string(const char *string, const char *what, char **new_string
        int result;
        u8 *dup;
 
-       result = vdo_allocate(strlen(string) + 1, u8, what, &dup);
+       result = vdo_allocate(strlen(string) + 1, what, &dup);
        if (result != VDO_SUCCESS)
                return result;
 
index ab2375d549f4aaf92ea236f2b98a13ff1fd14fb6..bc5527327ed806d89d610b3161098b6a476d944d 100644 (file)
 /* Custom memory allocation function that tracks memory usage */
 int __must_check vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr);
 
-/*
- * Allocate storage based on element counts, sizes, and alignment.
- *
- * This is a generalized form of our allocation use case: It allocates an array of objects,
- * optionally preceded by one object of another type (i.e., a struct with trailing variable-length
- * array), with the alignment indicated.
- *
- * Why is this inline? The sizes and alignment will always be constant, when invoked through the
- * macros below, and often the count will be a compile-time constant 1 or the number of extra bytes
- * will be a compile-time constant 0. So at least some of the arithmetic can usually be optimized
- * away, and the run-time selection between allocation functions always can. In many cases, it'll
- * boil down to just a function call with a constant size.
- *
- * @count: The number of objects to allocate
- * @size: The size of an object
- * @extra: The number of additional bytes to allocate
- * @align: The required alignment
- * @what: What is being allocated (for error logging)
- * @ptr: A pointer to hold the allocated memory
- *
- * Return: VDO_SUCCESS or an error code
- */
-static inline int __vdo_do_allocation(size_t count, size_t size, size_t extra,
-                                     size_t align, const char *what, void *ptr)
-{
-       size_t total_size = count * size + extra;
-
-       /* Overflow check: */
-       if ((size > 0) && (count > ((SIZE_MAX - extra) / size))) {
-               /*
-                * This is kind of a hack: We rely on the fact that SIZE_MAX would cover the entire
-                * address space (minus one byte) and thus the system can never allocate that much
-                * and the call will always fail. So we can report an overflow as "out of memory"
-                * by asking for "merely" SIZE_MAX bytes.
-                */
-               total_size = SIZE_MAX;
-       }
-
-       return vdo_allocate_memory(total_size, align, what, ptr);
-}
-
 /*
  * Allocate one or more elements of the indicated type, logging an error if the allocation fails.
  * The memory will be zeroed.
  *
  * @COUNT: The number of objects to allocate
- * @TYPE: The type of objects to allocate. This type determines the alignment of the allocation.
  * @WHAT: What is being allocated (for error logging)
  * @PTR: A pointer to hold the allocated memory
  *
  * Return: VDO_SUCCESS or an error code
  */
-#define vdo_allocate(COUNT, TYPE, WHAT, PTR) \
-       __vdo_do_allocation(COUNT, sizeof(TYPE), 0, __alignof__(TYPE), WHAT, PTR)
+#define vdo_allocate(COUNT, WHAT, PTR)                                 \
+       vdo_allocate_memory(size_mul((COUNT), sizeof(typeof(**(PTR)))), \
+                           __alignof__(typeof(**(PTR))), WHAT, PTR)
 
 /*
  * Allocate a structure with a flexible array member, with a specified number of elements, logging
index 75dfcd7c5f631414c033c12fb1294a21bf0a00b2..b4c919780c226d89f1d644a1de20075c9c34159d 100644 (file)
@@ -420,7 +420,7 @@ int vdo_write_stats(struct vdo *vdo, char *buf, unsigned int maxlen)
        struct vdo_statistics *stats;
        int result;
 
-       result = vdo_allocate(1, struct vdo_statistics, __func__, &stats);
+       result = vdo_allocate(1, __func__, &stats);
        if (result != VDO_SUCCESS) {
                vdo_log_error("Cannot allocate memory to write VDO statistics");
                return result;
index e638694d896cec1b8d8717b8ecf6155f0ff4bef3..ea2d8d14495c065ba6d7e40f34ec0efbbc87780b 100644 (file)
@@ -145,7 +145,7 @@ int vdo_make_packer(struct vdo *vdo, block_count_t bin_count, struct packer **pa
        block_count_t i;
        int result;
 
-       result = vdo_allocate(1, struct packer, __func__, &packer);
+       result = vdo_allocate(1, __func__, &packer);
        if (result != VDO_SUCCESS)
                return result;
 
index 6da30396137608996044777549d8b217f31c17df..f03939cc89e382451c4e208f0b979f0ec22c8cc5 100644 (file)
@@ -593,32 +593,29 @@ static int __must_check initialize_lock_counter(struct recovery_journal *journal
        struct thread_config *config = &vdo->thread_config;
        struct lock_counter *counter = &journal->lock_counter;
 
-       result = vdo_allocate(journal->size, u16, __func__, &counter->journal_counters);
+       result = vdo_allocate(journal->size, __func__, &counter->journal_counters);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(journal->size, atomic_t, __func__,
-                             &counter->journal_decrement_counts);
+       result = vdo_allocate(journal->size, __func__, &counter->journal_decrement_counts);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(journal->size * config->logical_zone_count, u16, __func__,
+       result = vdo_allocate(journal->size * config->logical_zone_count, __func__,
                              &counter->logical_counters);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(journal->size, atomic_t, __func__,
-                             &counter->logical_zone_counts);
+       result = vdo_allocate(journal->size, __func__, &counter->logical_zone_counts);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(journal->size * config->physical_zone_count, u16, __func__,
+       result = vdo_allocate(journal->size * config->physical_zone_count, __func__,
                              &counter->physical_counters);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(journal->size, atomic_t, __func__,
-                             &counter->physical_zone_counts);
+       result = vdo_allocate(journal->size, __func__, &counter->physical_zone_counts);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -672,7 +669,7 @@ static int initialize_recovery_block(struct vdo *vdo, struct recovery_journal *j
         * Allocate a full block for the journal block even though not all of the space is used
         * since the VIO needs to write a full disk block.
         */
-       result = vdo_allocate(VDO_BLOCK_SIZE, char, __func__, &data);
+       result = vdo_allocate(VDO_BLOCK_SIZE, __func__, &data);
        if (result != VDO_SUCCESS)
                return result;
 
index e479d35820400280cca99eaf141a529d84dad671..43ce65a69e618a408163ab8ac398406911eeea44 100644 (file)
@@ -1417,8 +1417,7 @@ static int parse_journal_for_rebuild(struct repair_completion *repair)
         * packed_recovery_journal_entry from every valid journal block.
         */
        count = ((repair->highest_tail - repair->block_map_head + 1) * entries_per_block);
-       result = vdo_allocate(count, struct numbered_block_mapping, __func__,
-                             &repair->entries);
+       result = vdo_allocate(count, __func__, &repair->entries);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1464,8 +1463,7 @@ static int extract_new_mappings(struct repair_completion *repair)
         * Allocate an array of numbered_block_mapping structs just large enough to transcribe
         * every packed_recovery_journal_entry from every valid journal block.
         */
-       result = vdo_allocate(repair->entry_count, struct numbered_block_mapping,
-                             __func__, &repair->entries);
+       result = vdo_allocate(repair->entry_count, __func__, &repair->entries);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -1727,12 +1725,11 @@ void vdo_repair(struct vdo_completion *parent)
        prepare_repair_completion(repair, finish_repair, VDO_ZONE_TYPE_ADMIN);
        repair->page_count = page_count;
 
-       result = vdo_allocate(remaining * VDO_BLOCK_SIZE, char, __func__,
-                             &repair->journal_data);
+       result = vdo_allocate(remaining * VDO_BLOCK_SIZE, __func__, &repair->journal_data);
        if (abort_on_error(result, repair))
                return;
 
-       result = vdo_allocate(vio_count, struct vio, __func__, &repair->vios);
+       result = vdo_allocate(vio_count, __func__, &repair->vios);
        if (abort_on_error(result, repair))
                return;
 
index 286fc4465a92073a8e56f7307c6ef129c9539dac..7fcbb361b38d1f86f8676823ec9f2e1a3a48d078 100644 (file)
@@ -2453,8 +2453,7 @@ static int allocate_slab_counters(struct vdo_slab *slab)
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(slab->reference_block_count, struct reference_block,
-                             __func__, &slab->reference_blocks);
+       result = vdo_allocate(slab->reference_block_count, __func__, &slab->reference_blocks);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -2463,8 +2462,7 @@ static int allocate_slab_counters(struct vdo_slab *slab)
         * so we can word-search even at the very end.
         */
        bytes = (slab->reference_block_count * COUNTS_PER_BLOCK) + (2 * BYTES_PER_WORD);
-       result = vdo_allocate(bytes, vdo_refcount_t, "ref counts array",
-                             &slab->counters);
+       result = vdo_allocate(bytes, "ref counts array", &slab->counters);
        if (result != VDO_SUCCESS) {
                vdo_free(vdo_forget(slab->reference_blocks));
                return result;
@@ -3563,8 +3561,7 @@ static int get_slab_statuses(struct block_allocator *allocator,
        struct slab_status *statuses;
        struct slab_iterator iterator = get_slab_iterator(allocator);
 
-       result = vdo_allocate(allocator->slab_count, struct slab_status, __func__,
-                             &statuses);
+       result = vdo_allocate(allocator->slab_count, __func__, &statuses);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -3739,13 +3736,12 @@ static int initialize_slab_journal(struct vdo_slab *slab)
        const struct slab_config *slab_config = &slab->allocator->depot->slab_config;
        int result;
 
-       result = vdo_allocate(slab_config->slab_journal_blocks, struct journal_lock,
-                             __func__, &journal->locks);
+       result = vdo_allocate(slab_config->slab_journal_blocks, __func__, &journal->locks);
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(VDO_BLOCK_SIZE, char, "struct packed_slab_journal_block",
-                             (char **) &journal->block);
+       BUILD_BUG_ON(sizeof(*journal->block) != VDO_BLOCK_SIZE);
+       result = vdo_allocate(1, "struct packed_slab_journal_block", &journal->block);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -3800,7 +3796,7 @@ static int __must_check make_slab(physical_block_number_t slab_origin,
        struct vdo_slab *slab;
        int result;
 
-       result = vdo_allocate(1, struct vdo_slab, __func__, &slab);
+       result = vdo_allocate(1, __func__, &slab);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -3857,8 +3853,7 @@ static int allocate_slabs(struct slab_depot *depot, slab_count_t slab_count)
        physical_block_number_t slab_origin;
        int result;
 
-       result = vdo_allocate(slab_count, struct vdo_slab *,
-                             "slab pointer array", &depot->new_slabs);
+       result = vdo_allocate(slab_count, "slab pointer array", &depot->new_slabs);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -4011,8 +4006,7 @@ static int initialize_slab_scrubber(struct block_allocator *allocator)
        char *journal_data;
        int result;
 
-       result = vdo_allocate(VDO_BLOCK_SIZE * slab_journal_size,
-                             char, __func__, &journal_data);
+       result = vdo_allocate(VDO_BLOCK_SIZE * slab_journal_size, __func__, &journal_data);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -4045,7 +4039,7 @@ static int __must_check initialize_slab_summary_block(struct block_allocator *al
        struct slab_summary_block *block = &allocator->summary_blocks[index];
        int result;
 
-       result = vdo_allocate(VDO_BLOCK_SIZE, char, __func__, &block->outgoing_entries);
+       result = vdo_allocate(VDO_BLOCK_SIZE, __func__, &block->outgoing_entries);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -4114,8 +4108,7 @@ static int __must_check initialize_block_allocator(struct slab_depot *depot,
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(VDO_SLAB_SUMMARY_BLOCKS_PER_ZONE,
-                             struct slab_summary_block, __func__,
+       result = vdo_allocate(VDO_SLAB_SUMMARY_BLOCKS_PER_ZONE, __func__,
                              &allocator->summary_blocks);
        if (result != VDO_SUCCESS)
                return result;
@@ -4174,8 +4167,7 @@ static int allocate_components(struct slab_depot *depot,
 
        depot->summary_origin = summary_partition->offset;
        depot->hint_shift = vdo_get_slab_summary_hint_shift(depot->slab_size_shift);
-       result = vdo_allocate(MAXIMUM_VDO_SLAB_SUMMARY_ENTRIES,
-                             struct slab_summary_entry, __func__,
+       result = vdo_allocate(MAXIMUM_VDO_SLAB_SUMMARY_ENTRIES, __func__,
                              &depot->summary_entries);
        if (result != VDO_SUCCESS)
                return result;
index ec08478dd01397cdc0e159fc3b49c9bf6a88e0a7..826afc952b56c31a28b59b8113c7ecab678ba523 100644 (file)
@@ -56,7 +56,7 @@ int vdo_create_thread(void (*thread_function)(void *), void *thread_data,
        struct thread *thread;
        int result;
 
-       result = vdo_allocate(1, struct thread, __func__, &thread);
+       result = vdo_allocate(1, __func__, &thread);
        if (result != VDO_SUCCESS) {
                vdo_log_warning("Error allocating memory for %s", name);
                return result;
index 09fd0628d18c7c4111f4bf44619dd0d9d22733b2..167cf93a284accc953e3b8189665d4fb5abda545 100644 (file)
@@ -207,29 +207,28 @@ static int __must_check initialize_thread_config(struct thread_count_config coun
                config->hash_zone_count = counts.hash_zones;
        }
 
-       result = vdo_allocate(config->logical_zone_count, thread_id_t,
-                             "logical thread array", &config->logical_threads);
+       result = vdo_allocate(config->logical_zone_count, "logical thread array",
+                             &config->logical_threads);
        if (result != VDO_SUCCESS) {
                uninitialize_thread_config(config);
                return result;
        }
 
-       result = vdo_allocate(config->physical_zone_count, thread_id_t,
-                             "physical thread array", &config->physical_threads);
+       result = vdo_allocate(config->physical_zone_count, "physical thread array",
+                             &config->physical_threads);
        if (result != VDO_SUCCESS) {
                uninitialize_thread_config(config);
                return result;
        }
 
-       result = vdo_allocate(config->hash_zone_count, thread_id_t,
-                             "hash thread array", &config->hash_zone_threads);
+       result = vdo_allocate(config->hash_zone_count, "hash thread array",
+                             &config->hash_zone_threads);
        if (result != VDO_SUCCESS) {
                uninitialize_thread_config(config);
                return result;
        }
 
-       result = vdo_allocate(config->bio_thread_count, thread_id_t,
-                             "bio thread array", &config->bio_threads);
+       result = vdo_allocate(config->bio_thread_count, "bio thread array", &config->bio_threads);
        if (result != VDO_SUCCESS) {
                uninitialize_thread_config(config);
                return result;
@@ -269,7 +268,7 @@ static int __must_check read_geometry_block(struct vdo *vdo)
        char *block;
        int result;
 
-       result = vdo_allocate(VDO_BLOCK_SIZE, u8, __func__, &block);
+       result = vdo_allocate(VDO_BLOCK_SIZE, __func__, &block);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -493,7 +492,7 @@ static int initialize_vdo(struct vdo *vdo, struct device_config *config,
                     config->thread_counts.hash_zones, vdo->thread_config.thread_count);
 
        /* Compression context storage */
-       result = vdo_allocate(config->thread_counts.cpu_threads, char *, "LZ4 context",
+       result = vdo_allocate(config->thread_counts.cpu_threads, "LZ4 context",
                              &vdo->compression_context);
        if (result != VDO_SUCCESS) {
                *reason = "cannot allocate LZ4 context";
@@ -501,7 +500,7 @@ static int initialize_vdo(struct vdo *vdo, struct device_config *config,
        }
 
        for (i = 0; i < config->thread_counts.cpu_threads; i++) {
-               result = vdo_allocate(LZ4_MEM_COMPRESS, char, "LZ4 context",
+               result = vdo_allocate(LZ4_MEM_COMPRESS, "LZ4 context",
                                      &vdo->compression_context[i]);
                if (result != VDO_SUCCESS) {
                        *reason = "cannot allocate LZ4 context";
@@ -537,7 +536,7 @@ int vdo_make(unsigned int instance, struct device_config *config, char **reason,
        /* Initialize with a generic failure reason to prevent returning garbage. */
        *reason = "Unspecified error";
 
-       result = vdo_allocate(1, struct vdo, __func__, &vdo);
+       result = vdo_allocate(1, __func__, &vdo);
        if (result != VDO_SUCCESS) {
                *reason = "Cannot allocate VDO";
                return result;
@@ -554,8 +553,7 @@ int vdo_make(unsigned int instance, struct device_config *config, char **reason,
 
        snprintf(vdo->thread_name_prefix, sizeof(vdo->thread_name_prefix),
                 "vdo%u", instance);
-       result = vdo_allocate(vdo->thread_config.thread_count,
-                             struct vdo_thread, __func__, &vdo->threads);
+       result = vdo_allocate(vdo->thread_config.thread_count, __func__, &vdo->threads);
        if (result != VDO_SUCCESS) {
                *reason = "Cannot allocate thread structures";
                return result;
@@ -724,8 +722,7 @@ static int initialize_super_block(struct vdo *vdo, struct vdo_super_block *super
 {
        int result;
 
-       result = vdo_allocate(VDO_BLOCK_SIZE, char, "encoded super block",
-                             (char **) &vdo->super_block.buffer);
+       result = vdo_allocate(VDO_BLOCK_SIZE, "encoded super block", &vdo->super_block.buffer);
        if (result != VDO_SUCCESS)
                return result;
 
@@ -997,8 +994,7 @@ int vdo_register_read_only_listener(struct vdo *vdo, void *listener,
        if (result != VDO_SUCCESS)
                return result;
 
-       result = vdo_allocate(1, struct read_only_listener, __func__,
-                             &read_only_listener);
+       result = vdo_allocate(1, __func__, &read_only_listener);
        if (result != VDO_SUCCESS)
                return result;
 
index cc739d52a70c448e95bc6a7150fada205eb5386f..ea8ac619ff1b3e7c4a4425b0503929fa551d007c 100644 (file)
@@ -129,7 +129,7 @@ int create_multi_block_metadata_vio(struct vdo *vdo, enum vio_type vio_type,
         * Metadata vios should use direct allocation and not use the buffer pool, which is
         * reserved for submissions from the linux block layer.
         */
-       result = vdo_allocate(1, struct vio, __func__, &vio);
+       result = vdo_allocate(1, __func__, &vio);
        if (result != VDO_SUCCESS) {
                vdo_log_error("metadata vio allocation failure %d", result);
                return result;
@@ -335,8 +335,7 @@ int make_vio_pool(struct vdo *vdo, size_t pool_size, size_t block_count, thread_
        INIT_LIST_HEAD(&pool->available);
        INIT_LIST_HEAD(&pool->busy);
 
-       result = vdo_allocate(pool_size * per_vio_size, char,
-                             "VIO pool buffer", &pool->buffer);
+       result = vdo_allocate(pool_size * per_vio_size, "VIO pool buffer", &pool->buffer);
        if (result != VDO_SUCCESS) {
                free_vio_pool(pool);
                return result;