Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/action-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
32 changes: 10 additions & 22 deletions drivers/md/dm-vdo/block-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -2478,9 +2472,7 @@ static int make_forest(struct block_map *map, block_count_t entries)
return VDO_SUCCESS;
}

result = vdo_allocate_extended(struct forest, map->root_count,
struct block_map_tree, __func__,
&forest);
result = vdo_allocate_extended(map->root_count, trees, __func__, &forest);
if (result != VDO_SUCCESS)
return result;

Expand Down Expand Up @@ -2707,8 +2699,7 @@ void vdo_traverse_forest(struct block_map *map, vdo_entry_callback_fn callback,
struct cursors *cursors;
int result;

result = vdo_allocate_extended(struct cursors, map->root_count,
struct cursor, __func__, &cursors);
result = vdo_allocate_extended(map->root_count, cursors, __func__, &cursors);
if (result != VDO_SUCCESS) {
vdo_fail_completion(completion, result);
return;
Expand Down Expand Up @@ -2758,9 +2749,7 @@ static int __must_check initialize_block_map_zone(struct block_map *map,
zone->thread_id = vdo->thread_config.logical_threads[zone_number];
zone->block_map = map;

result = vdo_allocate_extended(struct dirty_lists, maximum_age,
dirty_era_t, __func__,
&zone->dirty_lists);
result = vdo_allocate_extended(maximum_age, eras, __func__, &zone->dirty_lists);
if (result != VDO_SUCCESS)
return result;

Expand Down Expand Up @@ -2900,9 +2889,8 @@ int vdo_decode_block_map(struct block_map_state_2_0 state, block_count_t logical
if (result != VDO_SUCCESS)
return result;

result = vdo_allocate_extended(struct block_map,
vdo->thread_config.logical_zone_count,
struct block_map_zone, __func__, &map);
result = vdo_allocate_extended(vdo->thread_config.logical_zone_count,
zones, __func__, &map);
if (result != VDO_SUCCESS)
return result;

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/block-map.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ struct block_map {
block_count_t next_entry_count;

zone_count_t zone_count;
struct block_map_zone zones[];
struct block_map_zone zones[] __counted_by(zone_count);
};

/**
Expand Down
3 changes: 1 addition & 2 deletions drivers/md/dm-vdo/data-vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,7 @@ int make_data_vio_pool(struct vdo *vdo, data_vio_count_t pool_size,
struct data_vio_pool *pool;
data_vio_count_t i;

result = vdo_allocate_extended(struct data_vio_pool, pool_size, struct data_vio,
__func__, &pool);
result = vdo_allocate_extended(pool_size, data_vios, __func__, &pool);
if (result != VDO_SUCCESS)
return result;

Expand Down
8 changes: 3 additions & 5 deletions drivers/md/dm-vdo/dedupe.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ struct hash_zones {
/* The number of zones */
zone_count_t zone_count;
/* The hash zones themselves */
struct hash_zone zones[];
struct hash_zone zones[] __counted_by(zone_count);
};

/* These are in milliseconds. */
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -2418,8 +2417,7 @@ int vdo_make_hash_zones(struct vdo *vdo, struct hash_zones **zones_ptr)
if (zone_count == 0)
return VDO_SUCCESS;

result = vdo_allocate_extended(struct hash_zones, zone_count, struct hash_zone,
__func__, &zones);
result = vdo_allocate_extended(zone_count, zones, __func__, &zones);
if (result != VDO_SUCCESS)
return result;

Expand Down
12 changes: 5 additions & 7 deletions drivers/md/dm-vdo/dm-vdo-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,15 @@ 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;

for (s = string; *s != 0; s++) {
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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/encodings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions drivers/md/dm-vdo/flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/funnel-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 3 additions & 5 deletions drivers/md/dm-vdo/funnel-workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/indexer/chapter-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/indexer/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 5 additions & 8 deletions drivers/md/dm-vdo/indexer/delta-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/indexer/funnel-requestqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/indexer/geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading