dm vdo memory-alloc: various fixes
Subsystems (3)
Matthew Sakai
maintainercover dm vdo memory-alloc: various fixes
This patchset includes various fixes to make the interface to the dm-vdo memory allocator cleaner.
Mike Snitzer (8):
dm vdo memory-alloc: remove UDS_ALLOCATE_NOWAIT macro
dm vdo memory-alloc: rename UDS_FORGET to uds_forget
dm vdo memory-alloc: rename UDS_FREE to uds_free
dm vdo memory-alloc: rename UDS_ALLOCATE to uds_allocate dm vdo memory-alloc: rename UDS_ALLOCATE_EXTENDED to
uds_allocate_extended
dm vdo memory-alloc: rename uds_free_memory to uds_free dm vdo memory-alloc: cleanup flow of memory-alloc.h
dm vdo memory-alloc: mark branch unlikely() in uds_allocate_memory()
drivers/md/dm-vdo-target.c | 36 +++++------ drivers/md/dm-vdo/action-manager.c | 2 +- drivers/md/dm-vdo/admin-state.c | 2 +- drivers/md/dm-vdo/block-map.c | 58 ++++++++--------- drivers/md/dm-vdo/chapter-index.c | 6 +- drivers/md/dm-vdo/config.c | 4 +- drivers/md/dm-vdo/data-vio.c | 18 +++--- drivers/md/dm-vdo/dedupe.c | 30 ++++----- drivers/md/dm-vdo/delta-index.c | 20 +++--- drivers/md/dm-vdo/encodings.c | 4 +- drivers/md/dm-vdo/flush.c | 12 ++-- drivers/md/dm-vdo/funnel-queue.c | 4 +- drivers/md/dm-vdo/funnel-requestqueue.c | 4 +- drivers/md/dm-vdo/funnel-workqueue.c | 26 ++++---- drivers/md/dm-vdo/geometry.c | 4 +- drivers/md/dm-vdo/index-layout.c | 58 ++++++++--------- drivers/md/dm-vdo/index-page-map.c | 20 +++--- drivers/md/dm-vdo/index-session.c | 14 ++-- drivers/md/dm-vdo/index.c | 28 ++++---- drivers/md/dm-vdo/int-map.c | 14 ++-- drivers/md/dm-vdo/io-factory.c | 14 ++-- drivers/md/dm-vdo/io-submitter.c | 10 +-- drivers/md/dm-vdo/logical-zone.c | 8 +-- drivers/md/dm-vdo/memory-alloc.c | 24 +++---- drivers/md/dm-vdo/memory-alloc.h | 65 +++++++++---------- drivers/md/dm-vdo/message-stats.c | 4 +- drivers/md/dm-vdo/open-chapter.c | 6 +- drivers/md/dm-vdo/packer.c | 14 ++-- drivers/md/dm-vdo/physical-zone.c | 16 ++--- drivers/md/dm-vdo/pointer-map.c | 14 ++-- drivers/md/dm-vdo/pool-sysfs.c | 2 +- drivers/md/dm-vdo/priority-table.c | 4 +- drivers/md/dm-vdo/radix-sort.c | 4 +- drivers/md/dm-vdo/recovery-journal.c | 36 +++++------ drivers/md/dm-vdo/repair.c | 24 +++---- drivers/md/dm-vdo/slab-depot.c | 80 +++++++++++------------ drivers/md/dm-vdo/slab-depot.h | 2 +- drivers/md/dm-vdo/sparse-cache.c | 18 +++--- drivers/md/dm-vdo/uds-sysfs.c | 4 +- drivers/md/dm-vdo/uds-threads.c | 6 +- drivers/md/dm-vdo/vdo.c | 86 ++++++++++++------------- drivers/md/dm-vdo/vio.c | 20 +++--- drivers/md/dm-vdo/volume-index.c | 16 ++--- drivers/md/dm-vdo/volume.c | 36 +++++------ 44 files changed, 434 insertions(+), 443 deletions(-)
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 1/8 dm vdo memory-alloc: remove UDS_ALLOCATE_NOWAIT macro
From: Mike Snitzer <[email protected]>
Only caller can easily open-code call to uds_allocate_memory_nowait().
--- drivers/md/dm-vdo/flush.c | 2 +- drivers/md/dm-vdo/memory-alloc.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/md/dm-vdo/flush.c +1 -1
@@ -104,7 +104,7 @@ static void *allocate_flush(gfp_t gfp_mask, void *pool_data)struct vdo_flush *flush;if ((gfp_mask &GFP_NOWAIT ) ==GFP_NOWAIT ) { - flush = UDS_ALLOCATE_NOWAIT(struct vdo_flush, __func__); + flush =uds_allocate_memory_nowait (sizeof (struct vdo_flush ), __func__); }else { int result = UDS_ALLOCATE(1, struct vdo_flush, __func__, &flush);
drivers/md/dm-vdo/memory-alloc.h +3 -5
@@ -141,18 +141,16 @@ static inline int __must_check uds_allocate_cache_aligned(size_t size, const chareturn uds_allocate_memory (size,L1_CACHE_BYTES , what, ptr); } -void *__must_check uds_allocate_memory_nowait (size_t size,const char *what); -/* * Allocate one element of the indicated type immediately, failing if the required memory is not * immediately available. * -* @TYPE: The type of objects to allocate -* @WHAT: What is being allocated (for error logging) +* @size: The number of bytes to allocate +* @what: What is being allocated (for error logging) * * Return: pointer to the memory, or NULL if the memory is not available. */ -#define UDS_ALLOCATE_NOWAIT (TYPE ,WHAT ) uds_allocate_memory_nowait(sizeof(TYPE), WHAT) +void *__must_check uds_allocate_memory_nowait (size_t size,const char *what);int __must_check uds_duplicate_string (const char *string,const char *what,char **new_string);
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 2/8 dm vdo memory-alloc: rename UDS_FORGET to uds_forget
From: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo-target.c | 12 +++---- drivers/md/dm-vdo/admin-state.c | 2 +- drivers/md/dm-vdo/block-map.c | 26 +++++++-------- drivers/md/dm-vdo/data-vio.c | 14 ++++---- drivers/md/dm-vdo/dedupe.c | 20 +++++------ drivers/md/dm-vdo/delta-index.c | 6 ++-- drivers/md/dm-vdo/flush.c | 2 +- drivers/md/dm-vdo/funnel-workqueue.c | 2 +- drivers/md/dm-vdo/index.c | 4 +-- drivers/md/dm-vdo/int-map.c | 10 +++--- drivers/md/dm-vdo/io-factory.c | 2 +- drivers/md/dm-vdo/io-submitter.c | 6 ++-- drivers/md/dm-vdo/logical-zone.c | 4 +-- drivers/md/dm-vdo/memory-alloc.h | 4 +-- drivers/md/dm-vdo/packer.c | 4 +-- drivers/md/dm-vdo/physical-zone.c | 8 ++--- drivers/md/dm-vdo/pointer-map.c | 10 +++--- drivers/md/dm-vdo/recovery-journal.c | 16 ++++----- drivers/md/dm-vdo/repair.c | 12 +++---- drivers/md/dm-vdo/slab-depot.c | 46 ++++++++++++------------- drivers/md/dm-vdo/sparse-cache.c | 2 +- drivers/md/dm-vdo/vdo.c | 50 ++++++++++++++-------------- drivers/md/dm-vdo/vio.c | 6 ++-- drivers/md/dm-vdo/volume-index.c | 6 ++-- drivers/md/dm-vdo/volume.c | 6 ++-- 25 files changed, 140 insertions(+), 140 deletions(-)
drivers/md/dm-vdo-target.c +6 -6
@@ -1723,7 +1723,7 @@ static int grow_layout(struct vdo *vdo, block_count_t old_size, block_count_t ne VDO_SLAB_SUMMARY_PARTITION), &vdo->next_layout);if (result !=VDO_SUCCESS ) { -dm_kcopyd_client_destroy (UDS_FORGET (vdo->partition_copier)); +dm_kcopyd_client_destroy (uds_forget (vdo->partition_copier));return result; }
@@ -1734,7 +1734,7 @@ static int grow_layout(struct vdo *vdo, block_count_t old_size, block_count_t neif (min_new_size > new_size) {/* Copying the journal and summary would destroy some old metadata. */ vdo_uninitialize_layout (&vdo->next_layout); -dm_kcopyd_client_destroy (UDS_FORGET (vdo->partition_copier)); +dm_kcopyd_client_destroy (uds_forget (vdo->partition_copier));return VDO_INCREMENT_TOO_SMALL ; }
@@ -1941,7 +1941,7 @@ static int vdo_ctr(struct dm_target *ti, unsigned int argc, char **argv)static void vdo_dtr (struct dm_target *ti) {struct device_config *config = ti->private; -struct vdo *vdo =UDS_FORGET (config->vdo); +struct vdo *vdo =uds_forget (config->vdo);list_del_init (&config->config_list);if (list_empty (&vdo->device_config_list)) {
@@ -1959,7 +1959,7 @@ static void vdo_dtr(struct dm_target *ti)if (vdo->dump_on_shutdown)vdo_dump_all (vdo,"device shutdown" ); -vdo_destroy (UDS_FORGET (vdo)); +vdo_destroy (uds_forget (vdo));uds_log_info ("device '%s' stopped" , device_name);uds_unregister_thread_device_id ();uds_unregister_allocating_thread ();
@@ -2346,7 +2346,7 @@ static void handle_load_error(struct vdo_completion *completion) (vdo->admin.phase == LOAD_PHASE_MAKE_DIRTY)) {uds_log_error_strerror (completion->result,"aborting load" ); vdo->admin.phase =LOAD_PHASE_DRAIN_JOURNAL ; -load_callback (UDS_FORGET (completion)); +load_callback (uds_forget (completion));return ; }
@@ -2659,7 +2659,7 @@ static void grow_physical_callback(struct vdo_completion *completion)case GROW_PHYSICAL_PHASE_UPDATE_COMPONENTS :vdo_uninitialize_layout (&vdo->layout); vdo->layout = vdo->next_layout; -UDS_FORGET (vdo->next_layout.head); +uds_forget (vdo->next_layout.head); vdo->states.vdo.config.physical_blocks = vdo->layout.size;vdo_update_slab_depot_size (vdo->depot);vdo_save_components (vdo, completion);
drivers/md/dm-vdo/admin-state.c +1 -1
@@ -204,7 +204,7 @@ bool vdo_finish_operation(struct admin_state *state, int result)if (!state->starting) {vdo_set_admin_state_code (state, state->next_state);if (state->waiter !=NULL ) -vdo_launch_completion (UDS_FORGET (state->waiter)); +vdo_launch_completion (uds_forget (state->waiter)); }return true;
drivers/md/dm-vdo/block-map.c +13 -13
@@ -1341,7 +1341,7 @@ int vdo_invalidate_page_cache(struct vdo_page_cache *cache) }/* Reset the page map by re-allocating it. */ -vdo_free_int_map (UDS_FORGET (cache->page_map)); +vdo_free_int_map (uds_forget (cache->page_map));return vdo_make_int_map (cache->page_count,0 , &cache->page_map); }
@@ -2508,7 +2508,7 @@ static void replace_forest(struct block_map *map)if (map->next_forest !=NULL ) {if (map->forest !=NULL )deforest (map->forest, map->forest->segments); - map->forest =UDS_FORGET (map->next_forest); + map->forest =uds_forget (map->next_forest); } map->entry_count = map->next_entry_count;
@@ -2524,7 +2524,7 @@ static void finish_cursor(struct cursor *cursor)struct cursors *cursors = cursor->parent;struct vdo_completion *parent = cursors->parent; -return_vio_to_pool (cursors->pool,UDS_FORGET (cursor->vio)); +return_vio_to_pool (cursors->pool,uds_forget (cursor->vio));if (--cursors->active_roots >0 )return ;
@@ -2863,19 +2863,19 @@ static void uninitialize_block_map_zone(struct block_map_zone *zone) {struct vdo_page_cache *cache = &zone->page_cache; -UDS_FREE (UDS_FORGET (zone->dirty_lists)); -free_vio_pool (UDS_FORGET (zone->vio_pool)); -vdo_free_int_map (UDS_FORGET (zone->loading_pages)); +UDS_FREE (uds_forget (zone->dirty_lists)); +free_vio_pool (uds_forget (zone->vio_pool)); +vdo_free_int_map (uds_forget (zone->loading_pages));if (cache->infos !=NULL ) {struct page_info *info;for (info = cache->infos; info < cache->infos + cache->page_count; ++info) -free_vio (UDS_FORGET (info->vio)); +free_vio (uds_forget (info->vio)); } -vdo_free_int_map (UDS_FORGET (cache->page_map)); -UDS_FREE (UDS_FORGET (cache->infos)); -UDS_FREE (UDS_FORGET (cache->pages)); +vdo_free_int_map (uds_forget (cache->page_map)); +UDS_FREE (uds_forget (cache->infos)); +UDS_FREE (uds_forget (cache->pages)); }void vdo_free_block_map (struct block_map *map)
@@ -2890,8 +2890,8 @@ void vdo_free_block_map(struct block_map *map)vdo_abandon_block_map_growth (map);if (map->forest !=NULL ) -deforest (UDS_FORGET (map->forest),0 ); -UDS_FREE (UDS_FORGET (map->action_manager)); +deforest (uds_forget (map->forest),0 ); +UDS_FREE (uds_forget (map->action_manager));UDS_FREE (map); }
@@ -3108,7 +3108,7 @@ void vdo_grow_block_map(struct block_map *map, struct vdo_completion *parent)void vdo_abandon_block_map_growth (struct block_map *map) { -struct forest *forest =UDS_FORGET (map->next_forest); +struct forest *forest =uds_forget (map->next_forest);if (forest !=NULL )deforest (forest, forest->segments -1 );
drivers/md/dm-vdo/data-vio.c +7 -7
@@ -822,10 +822,10 @@ static void destroy_data_vio(struct data_vio *data_vio)if (data_vio ==NULL )return ; -vdo_free_bio (UDS_FORGET (data_vio->vio.bio)); -UDS_FREE (UDS_FORGET (data_vio->vio.data)); -UDS_FREE (UDS_FORGET (data_vio->compression.block)); -UDS_FREE (UDS_FORGET (data_vio->scratch_block)); +vdo_free_bio (uds_forget (data_vio->vio.bio)); +UDS_FREE (uds_forget (data_vio->vio.data)); +UDS_FREE (uds_forget (data_vio->compression.block)); +UDS_FREE (uds_forget (data_vio->scratch_block)); }/**
@@ -869,7 +869,7 @@ int make_data_vio_pool(struct vdo *vdo, result =uds_make_funnel_queue (&pool->queue);if (result !=UDS_SUCCESS ) { -free_data_vio_pool (UDS_FORGET (pool)); +free_data_vio_pool (uds_forget (pool));return result; }
@@ -926,7 +926,7 @@ void free_data_vio_pool(struct data_vio_pool *pool)destroy_data_vio (data_vio); } -uds_free_funnel_queue (UDS_FORGET (pool->queue)); +uds_free_funnel_queue (uds_forget (pool->queue));UDS_FREE (pool); }
@@ -1425,7 +1425,7 @@ void release_data_vio_allocation_lock(struct data_vio *data_vio, bool reset)vdo_release_physical_zone_pbn_lock (allocation->zone, locked_pbn, -UDS_FORGET (allocation->lock)); +uds_forget (allocation->lock)); }/**
drivers/md/dm-vdo/dedupe.c +10 -10
@@ -686,7 +686,7 @@ static void unlock_duplicate_pbn(struct vdo_completion *completion)vdo_release_physical_zone_pbn_lock (agent->duplicate.zone, agent->duplicate.pbn, -UDS_FORGET (lock->duplicate_lock)); +uds_forget (lock->duplicate_lock));if (lock->state ==VDO_HASH_LOCK_BYPASSING ) {complete_data_vio (completion);return ;
@@ -883,7 +883,7 @@ static int __must_check acquire_lock(struct hash_zone *zone, (replace_lock !=NULL ), (void **) &lock);if (result !=VDO_SUCCESS ) { -return_hash_lock_to_pool (zone,UDS_FORGET (new_lock)); +return_hash_lock_to_pool (zone,uds_forget (new_lock));return result; }
@@ -901,7 +901,7 @@ static int __must_check acquire_lock(struct hash_zone *zone, lock->registered = true; }else {/* There's already a lock for the hash, so we don't need the borrowed lock. */ -return_hash_lock_to_pool (zone,UDS_FORGET (new_lock)); +return_hash_lock_to_pool (zone,uds_forget (new_lock)); } *lock_ptr = lock;
@@ -1956,7 +1956,7 @@ static void transfer_allocation_lock(struct data_vio *data_vio)* Since the lock is being transferred, the holder count doesn't change (and isn't even * safe to examine on this thread). */ - hash_lock->duplicate_lock =UDS_FORGET (allocation->lock); + hash_lock->duplicate_lock =uds_forget (allocation->lock); }/**
@@ -2247,7 +2247,7 @@ static int initialize_index(struct vdo *vdo, struct hash_zones *zones) result =vdo_make_thread (vdo, vdo->thread_config.dedupe_thread, &uds_queue_type,1 ,NULL );if (result !=VDO_SUCCESS ) { -uds_destroy_index_session (UDS_FORGET (zones->index_session)); +uds_destroy_index_session (uds_forget (zones->index_session));uds_log_error ("UDS index queue initialization failed (%d)" , result);return result; }
@@ -2509,7 +2509,7 @@ void vdo_finish_dedupe_index(struct hash_zones *zones)if (zones ==NULL )return ; -uds_destroy_index_session (UDS_FORGET (zones->index_session)); +uds_destroy_index_session (uds_forget (zones->index_session)); }/**
@@ -2523,14 +2523,14 @@ void vdo_free_hash_zones(struct hash_zones *zones)if (zones ==NULL )return ; -UDS_FREE (UDS_FORGET (zones->manager)); +UDS_FREE (uds_forget (zones->manager));for (i =0 ; i < zones->zone_count; i++) {struct hash_zone *zone = &zones->zones[i]; -uds_free_funnel_queue (UDS_FORGET (zone->timed_out_complete)); -vdo_free_pointer_map (UDS_FORGET (zone->hash_lock_map)); -UDS_FREE (UDS_FORGET (zone->lock_array)); +uds_free_funnel_queue (uds_forget (zone->timed_out_complete)); +vdo_free_pointer_map (uds_forget (zone->hash_lock_map)); +UDS_FREE (uds_forget (zone->lock_array)); }if (zones->index_session !=NULL )
drivers/md/dm-vdo/delta-index.c +3 -3
@@ -310,9 +310,9 @@ void uds_uninitialize_delta_index(struct delta_index *delta_index)return ;for (z =0 ; z < delta_index->zone_count; z++) { -UDS_FREE (UDS_FORGET (delta_index->delta_zones[z].new_offsets)); -UDS_FREE (UDS_FORGET (delta_index->delta_zones[z].delta_lists)); -UDS_FREE (UDS_FORGET (delta_index->delta_zones[z].memory)); +UDS_FREE (uds_forget (delta_index->delta_zones[z].new_offsets)); +UDS_FREE (uds_forget (delta_index->delta_zones[z].delta_lists)); +UDS_FREE (uds_forget (delta_index->delta_zones[z].memory)); }UDS_FREE (delta_index->delta_zones);
drivers/md/dm-vdo/flush.c +1 -1
@@ -161,7 +161,7 @@ void vdo_free_flusher(struct flusher *flusher)return ;if (flusher->flush_pool !=NULL ) -mempool_destroy (UDS_FORGET (flusher->flush_pool)); +mempool_destroy (uds_forget (flusher->flush_pool));UDS_FREE (flusher); }
drivers/md/dm-vdo/funnel-workqueue.c +1 -1
@@ -453,7 +453,7 @@ int vdo_make_work_queue(const char *thread_name_prefix,if (result !=VDO_SUCCESS ) { queue->num_service_queues = i;/* Destroy previously created subordinates. */ -vdo_free_work_queue (UDS_FORGET (*queue_ptr)); +vdo_free_work_queue (uds_forget (*queue_ptr));return result; } }
drivers/md/dm-vdo/index.c +2 -2
@@ -623,7 +623,7 @@ static void execute_zone_request(struct uds_request *request) request->zone_message.type);/* Once the message is processed it can be freed. */ -UDS_FREE (UDS_FORGET (request)); +UDS_FREE (uds_forget (request));return ; }
@@ -1308,7 +1308,7 @@ void uds_free_index(struct uds_index *index) }uds_free_volume (index->volume); -uds_free_index_layout (UDS_FORGET (index->layout)); +uds_free_index_layout (uds_forget (index->layout));UDS_FREE (index); }
drivers/md/dm-vdo/int-map.c +5 -5
@@ -207,7 +207,7 @@ int vdo_make_int_map(size_t initial_capacity, unsigned int initial_load, struct result =allocate_buckets (map, capacity);if (result !=UDS_SUCCESS ) { -vdo_free_int_map (UDS_FORGET (map)); +vdo_free_int_map (uds_forget (map));return result; }
@@ -227,8 +227,8 @@ void vdo_free_int_map(struct int_map *map)if (map ==NULL )return ; -UDS_FREE (UDS_FORGET (map->buckets)); -UDS_FREE (UDS_FORGET (map)); +UDS_FREE (uds_forget (map->buckets)); +UDS_FREE (uds_forget (map)); }/**
@@ -408,14 +408,14 @@ static int resize_buckets(struct int_map *map) result =vdo_int_map_put (map, entry->key, entry->value, true,NULL );if (result !=UDS_SUCCESS ) {/* Destroy the new partial map and restore the map from the stack. */ -UDS_FREE (UDS_FORGET (map->buckets)); +UDS_FREE (uds_forget (map->buckets)); *map = old_map;return result; } }/* Destroy the old bucket array. */ -UDS_FREE (UDS_FORGET (old_map.buckets)); +UDS_FREE (uds_forget (old_map.buckets));return UDS_SUCCESS ; }
drivers/md/dm-vdo/io-factory.c +1 -1
@@ -186,7 +186,7 @@ static int position_reader(struct buffered_reader *reader, sector_t block_numberreturn UDS_OUT_OF_RANGE ;if (reader->buffer !=NULL ) -dm_bufio_release (UDS_FORGET (reader->buffer)); +dm_bufio_release (uds_forget (reader->buffer)); data =dm_bufio_read (reader->client, block_number, &buffer);if (IS_ERR (data))
drivers/md/dm-vdo/io-submitter.c +3 -3
@@ -428,7 +428,7 @@ int vdo_make_io_submitter(unsigned int thread_count,* Clean up the partially initialized bio-queue entirely and indicate that * initialization failed. */ -vdo_free_int_map (UDS_FORGET (bio_queue_data->map)); +vdo_free_int_map (uds_forget (bio_queue_data->map));uds_log_error ("bio queue initialization failed %d" , result);vdo_cleanup_io_submitter (io_submitter);vdo_free_io_submitter (io_submitter);
@@ -476,8 +476,8 @@ void vdo_free_io_submitter(struct io_submitter *io_submitter)for (i = io_submitter->num_bio_queues_used -1 ; i >=0 ; i--) { io_submitter->num_bio_queues_used--;/* vdo_destroy() will free the work queue, so just give up our reference to it. */ -UDS_FORGET (io_submitter->bio_queue_data[i].queue); -vdo_free_int_map (UDS_FORGET (io_submitter->bio_queue_data[i].map)); +uds_forget (io_submitter->bio_queue_data[i].queue); +vdo_free_int_map (uds_forget (io_submitter->bio_queue_data[i].map)); }UDS_FREE (io_submitter); }
drivers/md/dm-vdo/logical-zone.c +2 -2
@@ -137,10 +137,10 @@ void vdo_free_logical_zones(struct logical_zones *zones)if (zones ==NULL )return ; -UDS_FREE (UDS_FORGET (zones->manager)); +UDS_FREE (uds_forget (zones->manager));for (index =0 ; index < zones->zone_count; index++) -vdo_free_int_map (UDS_FORGET (zones->zones[index].lbn_operations)); +vdo_free_int_map (uds_forget (zones->zones[index].lbn_operations));UDS_FREE (zones); }
drivers/md/dm-vdo/memory-alloc.h +2 -2
@@ -21,7 +21,7 @@ void uds_free_memory(void *ptr);/* Free memory allocated with UDS_ALLOCATE(). */ #define UDS_FREE (PTR ) uds_free_memory(PTR) -static inline void *uds_forget (void **ptr_ptr) +static inline void *__uds_forget (void **ptr_ptr) {void *ptr = *ptr_ptr;
@@ -33,7 +33,7 @@ static inline void *uds_forget(void **ptr_ptr)* Null out a pointer and return a copy to it. This macro should be used when passing a pointer to * a function for which it is not safe to access the pointer once the function returns. */ -#define UDS_FORGET (ptr) uds_forget((void **) &(ptr)) +#define uds_forget (ptr) __uds_forget((void **) &(ptr))/* * Allocate storage based on element counts, sizes, and alignment.
drivers/md/dm-vdo/packer.c +2 -2
@@ -209,7 +209,7 @@ void vdo_free_packer(struct packer *packer)UDS_FREE (bin); } -UDS_FREE (UDS_FORGET (packer->canceled_bin)); +UDS_FREE (uds_forget (packer->canceled_bin));UDS_FREE (packer); }
@@ -683,7 +683,7 @@ void vdo_remove_lock_holder_from_packer(struct vdo_completion *completion)assert_data_vio_in_packer_zone (data_vio); - lock_holder =UDS_FORGET (data_vio->compression.lock_holder); + lock_holder =uds_forget (data_vio->compression.lock_holder); bin = lock_holder->compression.bin;ASSERT_LOG_ONLY ((bin !=NULL ),"data_vio in packer has a bin" );
drivers/md/dm-vdo/physical-zone.c +4 -4
@@ -349,7 +349,7 @@ static int initialize_zone(struct vdo *vdo, struct physical_zones *zones) zone->next = &zones->zones[(zone_number +1 ) % vdo->thread_config.physical_zone_count]; result =vdo_make_default_thread (vdo, zone->thread_id);if (result !=VDO_SUCCESS ) { -free_pbn_lock_pool (UDS_FORGET (zone->lock_pool)); +free_pbn_lock_pool (uds_forget (zone->lock_pool));vdo_free_int_map (zone->pbn_operations);return result; }
@@ -406,8 +406,8 @@ void vdo_free_physical_zones(struct physical_zones *zones)for (index =0 ; index < zones->zone_count; index++) {struct physical_zone *zone = &zones->zones[index]; -free_pbn_lock_pool (UDS_FORGET (zone->lock_pool)); -vdo_free_int_map (UDS_FORGET (zone->pbn_operations)); +free_pbn_lock_pool (uds_forget (zone->lock_pool)); +vdo_free_int_map (uds_forget (zone->pbn_operations)); }UDS_FREE (zones);
@@ -467,7 +467,7 @@ int vdo_attempt_physical_zone_pbn_lock(struct physical_zone *zone,if (lock !=NULL ) {/* The lock is already held, so we don't need the borrowed one. */ -return_pbn_lock_to_pool (zone->lock_pool,UDS_FORGET (new_lock)); +return_pbn_lock_to_pool (zone->lock_pool,uds_forget (new_lock)); result =ASSERT (lock->holder_count >0 ,"physical block %llu lock held" , (unsigned long long ) pbn);
drivers/md/dm-vdo/pointer-map.c +5 -5
@@ -177,7 +177,7 @@ int vdo_make_pointer_map(size_t initial_capacity, result =allocate_buckets (map, capacity);if (result !=UDS_SUCCESS ) { -vdo_free_pointer_map (UDS_FORGET (map)); +vdo_free_pointer_map (uds_forget (map));return result; }
@@ -197,8 +197,8 @@ void vdo_free_pointer_map(struct pointer_map *map)if (map ==NULL )return ; -UDS_FREE (UDS_FORGET (map->buckets)); -UDS_FREE (UDS_FORGET (map)); +UDS_FREE (uds_forget (map->buckets)); +UDS_FREE (uds_forget (map)); }/**
@@ -369,14 +369,14 @@ static int resize_buckets(struct pointer_map *map) result =vdo_pointer_map_put (map, entry->key, entry->value, true,NULL );if (result !=UDS_SUCCESS ) {/* Destroy the new partial map and restore the map from the stack. */ -UDS_FREE (UDS_FORGET (map->buckets)); +UDS_FREE (uds_forget (map->buckets)); *map = old_map;return result; } }/* Destroy the old bucket array. */ -UDS_FREE (UDS_FORGET (old_map.buckets)); +UDS_FREE (uds_forget (old_map.buckets));return UDS_SUCCESS ; }
drivers/md/dm-vdo/recovery-journal.c +8 -8
@@ -808,13 +808,13 @@ void vdo_free_recovery_journal(struct recovery_journal *journal)if (journal ==NULL )return ; -UDS_FREE (UDS_FORGET (journal->lock_counter.logical_zone_counts)); -UDS_FREE (UDS_FORGET (journal->lock_counter.physical_zone_counts)); -UDS_FREE (UDS_FORGET (journal->lock_counter.journal_counters)); -UDS_FREE (UDS_FORGET (journal->lock_counter.journal_decrement_counts)); -UDS_FREE (UDS_FORGET (journal->lock_counter.logical_counters)); -UDS_FREE (UDS_FORGET (journal->lock_counter.physical_counters)); -free_vio (UDS_FORGET (journal->flush_vio)); +UDS_FREE (uds_forget (journal->lock_counter.logical_zone_counts)); +UDS_FREE (uds_forget (journal->lock_counter.physical_zone_counts)); +UDS_FREE (uds_forget (journal->lock_counter.journal_counters)); +UDS_FREE (uds_forget (journal->lock_counter.journal_decrement_counts)); +UDS_FREE (uds_forget (journal->lock_counter.logical_counters)); +UDS_FREE (uds_forget (journal->lock_counter.physical_counters)); +free_vio (uds_forget (journal->flush_vio));/* * FIXME: eventually, the journal should be constructed in a quiescent state which
@@ -829,7 +829,7 @@ void vdo_free_recovery_journal(struct recovery_journal *journal)for (i =0 ; i <RECOVERY_JOURNAL_RESERVED_BLOCKS ; i++) {struct recovery_journal_block *block = &journal->blocks[i]; -UDS_FREE (UDS_FORGET (block->vio.data)); +UDS_FREE (uds_forget (block->vio.data));free_vio_components (&block->vio); }
drivers/md/dm-vdo/repair.c +6 -6
@@ -229,7 +229,7 @@ static void uninitialize_vios(struct repair_completion *repair)while (repair->vio_count >0 )free_vio_components (&repair->vios[--repair->vio_count]); -UDS_FREE (UDS_FORGET (repair->vios)); +UDS_FREE (uds_forget (repair->vios)); }static void free_repair_completion (struct repair_completion *repair)
@@ -244,8 +244,8 @@ static void free_repair_completion(struct repair_completion *repair) repair->completion.vdo->block_map->zones[0 ].page_cache.rebuilding = false;uninitialize_vios (repair); -UDS_FREE (UDS_FORGET (repair->journal_data)); -UDS_FREE (UDS_FORGET (repair->entries)); +UDS_FREE (uds_forget (repair->journal_data)); +UDS_FREE (uds_forget (repair->entries));UDS_FREE (repair); }
@@ -265,7 +265,7 @@ static void finish_repair(struct vdo_completion *completion) repair->highest_tail, repair->logical_blocks_used, repair->block_map_data_blocks); -free_repair_completion (UDS_FORGET (repair)); +free_repair_completion (uds_forget (repair));if (vdo_state_requires_read_only_rebuild (vdo->load_state)) {uds_log_info ("Read-only rebuild complete" );
@@ -298,7 +298,7 @@ static void abort_repair(struct vdo_completion *completion)else uds_log_warning ("Recovery aborted" ); -free_repair_completion (UDS_FORGET (repair)); +free_repair_completion (uds_forget (repair));vdo_continue_completion (parent, result); }
@@ -1120,7 +1120,7 @@ static void recover_block_map(struct vdo_completion *completion)if (repair->block_map_entry_count ==0 ) {uds_log_info ("Replaying 0 recovery entries into block map" ); -UDS_FREE (UDS_FORGET (repair->journal_data)); +UDS_FREE (uds_forget (repair->journal_data));launch_repair_completion (repair, load_slab_depot,VDO_ZONE_TYPE_ADMIN );return ; }
drivers/md/dm-vdo/slab-depot.c +23 -23
133 lines not on this page · raw message
drivers/md/dm-vdo/sparse-cache.c +1 -1
@@ -298,7 +298,7 @@ static void release_cached_chapter_index(struct cached_chapter_index *chapter)for (i =0 ; i < chapter->index_pages_count; i++)if (chapter->page_buffers[i] !=NULL ) -dm_bufio_release (UDS_FORGET (chapter->page_buffers[i])); +dm_bufio_release (uds_forget (chapter->page_buffers[i])); }void uds_free_sparse_cache (struct sparse_cache *cache)
drivers/md/dm-vdo/vdo.c +25 -25
114 lines not on this page · raw message
drivers/md/dm-vdo/vio.c +3 -3
@@ -71,7 +71,7 @@ void vdo_free_bio(struct bio *bio)return ;bio_uninit (bio); -UDS_FREE (UDS_FORGET (bio)); +UDS_FREE (uds_forget (bio)); } int allocate_vio_components(struct vdo *vdo,
@@ -164,7 +164,7 @@ void free_vio_components(struct vio *vio)return ;BUG_ON (is_data_vio (vio)); -vdo_free_bio (UDS_FORGET (vio->bio)); +vdo_free_bio (uds_forget (vio->bio)); }/**
@@ -405,7 +405,7 @@ void free_vio_pool(struct vio_pool *pool)ASSERT_LOG_ONLY (pool->size ==0 ,"VIO pool must not have missing entries when being freed" ); -UDS_FREE (UDS_FORGET (pool->buffer)); +UDS_FREE (uds_forget (pool->buffer));UDS_FREE (pool); }
drivers/md/dm-vdo/volume-index.c +3 -3
@@ -272,8 +272,8 @@ static int compute_volume_sub_index_parameters(const struct configuration *confistatic void uninitialize_volume_sub_index (struct volume_sub_index *sub_index) { -UDS_FREE (UDS_FORGET (sub_index->flush_chapters)); -UDS_FREE (UDS_FORGET (sub_index->zones)); +UDS_FREE (uds_forget (sub_index->flush_chapters)); +UDS_FREE (uds_forget (sub_index->zones));uds_uninitialize_delta_index (&sub_index->delta_index); }
@@ -287,7 +287,7 @@ void uds_free_volume_index(struct volume_index *volume_index)for (zone =0 ; zone < volume_index->zone_count; zone++)uds_destroy_mutex (&volume_index->zones[zone].hook_mutex); -UDS_FREE (UDS_FORGET (volume_index->zones)); +UDS_FREE (uds_forget (volume_index->zones)); }uninitialize_volume_sub_index (&volume_index->vi_non_hook);
drivers/md/dm-vdo/volume.c +3 -3
@@ -197,7 +197,7 @@ static void wait_for_pending_searches(struct page_cache *cache, u32 physical_pagstatic void release_page_buffer (struct cached_page *page) {if (page->buffer !=NULL ) -dm_bufio_release (UDS_FORGET (page->buffer)); +dm_bufio_release (uds_forget (page->buffer)); }static void clear_cache_page (struct page_cache *cache,struct cached_page *page)
@@ -1547,7 +1547,7 @@ int __must_check uds_replace_volume_storage(struct volume *volume,if (volume->sparse_cache !=NULL )uds_invalidate_sparse_cache (volume->sparse_cache);if (volume->client !=NULL ) -dm_bufio_client_destroy (UDS_FORGET (volume->client)); +dm_bufio_client_destroy (uds_forget (volume->client)); return uds_open_volume_bufio(layout, volume->geometry->bytes_per_page,
@@ -1780,7 +1780,7 @@ void uds_free_volume(struct volume *volume)uninitialize_page_cache (&volume->page_cache);uds_free_sparse_cache (volume->sparse_cache);if (volume->client !=NULL ) -dm_bufio_client_destroy (UDS_FORGET (volume->client)); +dm_bufio_client_destroy (uds_forget (volume->client));uds_destroy_cond (&volume->read_threads_cond);uds_destroy_cond (&volume->read_threads_read_done_cond);
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 3/8 dm vdo memory-alloc: rename UDS_FREE to uds_free
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo-target.c | 14 ++++----- drivers/md/dm-vdo/block-map.c | 22 +++++++------- drivers/md/dm-vdo/chapter-index.c | 4 +-- drivers/md/dm-vdo/config.c | 2 +- drivers/md/dm-vdo/data-vio.c | 8 ++--- drivers/md/dm-vdo/dedupe.c | 10 +++---- drivers/md/dm-vdo/delta-index.c | 10 +++---- drivers/md/dm-vdo/encodings.c | 2 +- drivers/md/dm-vdo/flush.c | 4 +-- drivers/md/dm-vdo/funnel-queue.c | 2 +- drivers/md/dm-vdo/funnel-requestqueue.c | 2 +- drivers/md/dm-vdo/funnel-workqueue.c | 18 +++++------ drivers/md/dm-vdo/geometry.c | 2 +- drivers/md/dm-vdo/index-layout.c | 40 ++++++++++++------------- drivers/md/dm-vdo/index-page-map.c | 12 ++++---- drivers/md/dm-vdo/index-session.c | 12 ++++---- drivers/md/dm-vdo/index.c | 16 +++++----- drivers/md/dm-vdo/int-map.c | 8 ++--- drivers/md/dm-vdo/io-factory.c | 6 ++-- drivers/md/dm-vdo/io-submitter.c | 2 +- drivers/md/dm-vdo/logical-zone.c | 4 +-- drivers/md/dm-vdo/memory-alloc.c | 8 ++--- drivers/md/dm-vdo/memory-alloc.h | 2 +- drivers/md/dm-vdo/message-stats.c | 2 +- drivers/md/dm-vdo/open-chapter.c | 4 +-- drivers/md/dm-vdo/packer.c | 6 ++-- drivers/md/dm-vdo/physical-zone.c | 4 +-- drivers/md/dm-vdo/pointer-map.c | 8 ++--- drivers/md/dm-vdo/pool-sysfs.c | 2 +- drivers/md/dm-vdo/priority-table.c | 2 +- drivers/md/dm-vdo/radix-sort.c | 2 +- drivers/md/dm-vdo/recovery-journal.c | 18 +++++------ drivers/md/dm-vdo/repair.c | 10 +++---- drivers/md/dm-vdo/slab-depot.c | 34 ++++++++++----------- drivers/md/dm-vdo/sparse-cache.c | 10 +++---- drivers/md/dm-vdo/uds-sysfs.c | 2 +- drivers/md/dm-vdo/uds-threads.c | 4 +-- drivers/md/dm-vdo/vdo.c | 28 ++++++++--------- drivers/md/dm-vdo/vio.c | 10 +++---- drivers/md/dm-vdo/volume-index.c | 8 ++--- drivers/md/dm-vdo/volume.c | 16 +++++----- 41 files changed, 190 insertions(+), 190 deletions(-)
drivers/md/dm-vdo-target.c +7 -7
@@ -192,12 +192,12 @@ static void free_device_config(struct device_config *config)if (config->owned_device !=NULL )dm_put_device (config->owning_target, config->owned_device); -UDS_FREE (config->parent_device_name); -UDS_FREE (config->original_string); +uds_free (config->parent_device_name); +uds_free (config->original_string);/* Reduce the chance a use-after-free (as in BZ 1669960) happens to work. */ memset (config,0 ,sizeof (*config)); -UDS_FREE (config); +uds_free (config); }/**
@@ -252,15 +252,15 @@ static void free_string_array(char **string_array)unsigned int offset;for (offset =0 ; string_array[offset] !=NULL ; offset++) -UDS_FREE (string_array[offset]); -UDS_FREE (string_array); +uds_free (string_array[offset]); +uds_free (string_array); }/* * Split the input string into substrings, separated at occurrences of the indicated character, * returning a null-terminated list of string pointers. * -* The string pointers and the pointer array itself should both be freed with UDS_FREE() when no +* The string pointers and the pointer array itself should both be freed with uds_free() when no * longer needed. This can be done with vdo_free_string_array (below) if the pointers in the array * are not changed. Since the array and copied strings are allocated by this function, it may only * be used in contexts where allocation is permitted.
@@ -2924,7 +2924,7 @@ static void vdo_module_destroy(void)ASSERT_LOG_ONLY (instances.count ==0 ,"should have no instance numbers still in use, but have %u" , instances.count); -UDS_FREE (instances.words); +uds_free (instances.words);memset (&instances,0 ,sizeof (struct instance_tracker ));uds_log_info ("unloaded version %s" ,CURRENT_VERSION );
drivers/md/dm-vdo/block-map.c +11 -11
@@ -2447,15 +2447,15 @@ static void deforest(struct forest *forest, size_t first_page_segment)size_t segment;for (segment = first_page_segment; segment < forest->segments; segment++) -UDS_FREE (forest->pages[segment]); -UDS_FREE (forest->pages); +uds_free (forest->pages[segment]); +uds_free (forest->pages); }for (root =0 ; root < forest->map->root_count; root++) -UDS_FREE (forest->trees[root].segments); +uds_free (forest->trees[root].segments); -UDS_FREE (forest->boundaries); -UDS_FREE (forest); +uds_free (forest->boundaries); +uds_free (forest); }/**
@@ -2528,7 +2528,7 @@ static void finish_cursor(struct cursor *cursor)if (--cursors->active_roots >0 )return ; -UDS_FREE (cursors); +uds_free (cursors);vdo_finish_completion (parent); }
@@ -2863,7 +2863,7 @@ static void uninitialize_block_map_zone(struct block_map_zone *zone) {struct vdo_page_cache *cache = &zone->page_cache; -UDS_FREE (uds_forget (zone->dirty_lists)); +uds_free (uds_forget (zone->dirty_lists));free_vio_pool (uds_forget (zone->vio_pool));vdo_free_int_map (uds_forget (zone->loading_pages));if (cache->infos !=NULL ) {
@@ -2874,8 +2874,8 @@ static void uninitialize_block_map_zone(struct block_map_zone *zone) }vdo_free_int_map (uds_forget (cache->page_map)); -UDS_FREE (uds_forget (cache->infos)); -UDS_FREE (uds_forget (cache->pages)); +uds_free (uds_forget (cache->infos)); +uds_free (uds_forget (cache->pages)); }void vdo_free_block_map (struct block_map *map)
@@ -2891,8 +2891,8 @@ void vdo_free_block_map(struct block_map *map)vdo_abandon_block_map_growth (map);if (map->forest !=NULL )deforest (uds_forget (map->forest),0 ); -UDS_FREE (uds_forget (map->action_manager)); -UDS_FREE (map); +uds_free (uds_forget (map->action_manager)); +uds_free (map); }/* @journal may be NULL. */
drivers/md/dm-vdo/chapter-index.c +2 -2
@@ -39,7 +39,7 @@ int uds_make_open_chapter_index(struct open_chapter_index **chapter_index, memory_size, 'm');if (result !=UDS_SUCCESS ) { -UDS_FREE (index); +uds_free (index);return result; }
@@ -54,7 +54,7 @@ void uds_free_open_chapter_index(struct open_chapter_index *chapter_index)return ;uds_uninitialize_delta_index (&chapter_index->delta_index); -UDS_FREE (chapter_index); +uds_free (chapter_index); }/* Re-initialize an open chapter index for a new chapter. */
drivers/md/dm-vdo/config.c +1 -1
@@ -369,7 +369,7 @@ void uds_free_configuration(struct configuration *config) {if (config !=NULL ) {uds_free_geometry (config->geometry); -UDS_FREE (config); +uds_free (config); } }
drivers/md/dm-vdo/data-vio.c +4 -4
@@ -823,9 +823,9 @@ static void destroy_data_vio(struct data_vio *data_vio)return ;vdo_free_bio (uds_forget (data_vio->vio.bio)); -UDS_FREE (uds_forget (data_vio->vio.data)); -UDS_FREE (uds_forget (data_vio->compression.block)); -UDS_FREE (uds_forget (data_vio->scratch_block)); +uds_free (uds_forget (data_vio->vio.data)); +uds_free (uds_forget (data_vio->compression.block)); +uds_free (uds_forget (data_vio->scratch_block)); }/**
@@ -927,7 +927,7 @@ void free_data_vio_pool(struct data_vio_pool *pool) }uds_free_funnel_queue (uds_forget (pool->queue)); -UDS_FREE (pool); +uds_free (pool); }static bool acquire_permit (struct limiter *limiter,struct bio *bio)
drivers/md/dm-vdo/dedupe.c +5 -5
@@ -2016,7 +2016,7 @@ static u32 hash_key(const void *key)static void dedupe_kobj_release (struct kobject *directory) { -UDS_FREE (container_of(directory ,struct hash_zones ,dedupe_directory )); +uds_free (container_of(directory ,struct hash_zones ,dedupe_directory )); }static ssize_t dedupe_status_show (struct kobject *directory,struct attribute *attr,char *buf)
@@ -2473,7 +2473,7 @@ int vdo_make_hash_zones(struct vdo *vdo, struct hash_zones **zones_ptr) result =initialize_index (vdo, zones);if (result !=VDO_SUCCESS ) { -UDS_FREE (zones); +uds_free (zones);return result; }
@@ -2523,14 +2523,14 @@ void vdo_free_hash_zones(struct hash_zones *zones)if (zones ==NULL )return ; -UDS_FREE (uds_forget (zones->manager)); +uds_free (uds_forget (zones->manager));for (i =0 ; i < zones->zone_count; i++) {struct hash_zone *zone = &zones->zones[i];uds_free_funnel_queue (uds_forget (zone->timed_out_complete));vdo_free_pointer_map (uds_forget (zone->hash_lock_map)); -UDS_FREE (uds_forget (zone->lock_array)); +uds_free (uds_forget (zone->lock_array)); }if (zones->index_session !=NULL )
@@ -2538,7 +2538,7 @@ void vdo_free_hash_zones(struct hash_zones *zones)ratelimit_state_exit (&zones->ratelimiter);if (vdo_get_admin_state_code (&zones->state) ==VDO_ADMIN_STATE_NEW ) -UDS_FREE (zones); +uds_free (zones);else kobject_put (&zones->dedupe_directory); }
drivers/md/dm-vdo/delta-index.c +5 -5
@@ -310,12 +310,12 @@ void uds_uninitialize_delta_index(struct delta_index *delta_index)return ;for (z =0 ; z < delta_index->zone_count; z++) { -UDS_FREE (uds_forget (delta_index->delta_zones[z].new_offsets)); -UDS_FREE (uds_forget (delta_index->delta_zones[z].delta_lists)); -UDS_FREE (uds_forget (delta_index->delta_zones[z].memory)); +uds_free (uds_forget (delta_index->delta_zones[z].new_offsets)); +uds_free (uds_forget (delta_index->delta_zones[z].delta_lists)); +uds_free (uds_forget (delta_index->delta_zones[z].memory)); } -UDS_FREE (delta_index->delta_zones); +uds_free (delta_index->delta_zones);memset (delta_index,0 ,sizeof (struct delta_index )); }
@@ -1101,7 +1101,7 @@ int uds_finish_restoring_delta_index(struct delta_index *delta_index, } } -UDS_FREE (data); +uds_free (data);return saved_result; }
drivers/md/dm-vdo/encodings.c +1 -1
@@ -932,7 +932,7 @@ void vdo_uninitialize_layout(struct layout *layout)struct partition *part = layout->head; layout->head = part->next; -UDS_FREE (part); +uds_free (part); }memset (layout,0 ,sizeof (struct layout ));
drivers/md/dm-vdo/flush.c +2 -2
@@ -123,7 +123,7 @@ static void *allocate_flush(gfp_t gfp_mask, void *pool_data)static void free_flush (void *element,void *pool_data__always_unused ) { -UDS_FREE (element); +uds_free (element); }/**
@@ -162,7 +162,7 @@ void vdo_free_flusher(struct flusher *flusher)if (flusher->flush_pool !=NULL )mempool_destroy (uds_forget (flusher->flush_pool)); -UDS_FREE (flusher); +uds_free (flusher); }/**
drivers/md/dm-vdo/funnel-queue.c +1 -1
@@ -33,7 +33,7 @@ int uds_make_funnel_queue(struct funnel_queue **queue_ptr)void uds_free_funnel_queue (struct funnel_queue *queue) { -UDS_FREE (queue); +uds_free (queue); }static struct funnel_queue_entry *get_oldest (struct funnel_queue *queue)
drivers/md/dm-vdo/funnel-requestqueue.c +1 -1
@@ -280,5 +280,5 @@ void uds_request_queue_finish(struct uds_request_queue *queue)uds_free_funnel_queue (queue->main_queue);uds_free_funnel_queue (queue->retry_queue); -UDS_FREE (queue); +uds_free (queue); }
drivers/md/dm-vdo/funnel-workqueue.c +9 -9
@@ -278,8 +278,8 @@ static void free_simple_work_queue(struct simple_work_queue *queue)for (i =0 ; i <=VDO_WORK_Q_MAX_PRIORITY ; i++)uds_free_funnel_queue (queue->priority_lists[i]); -UDS_FREE (queue->common.name); -UDS_FREE (queue); +uds_free (queue->common.name); +uds_free (queue); }static void free_round_robin_work_queue (struct round_robin_work_queue *queue)
@@ -292,9 +292,9 @@ static void free_round_robin_work_queue(struct round_robin_work_queue *queue)for (i =0 ; i < count; i++)free_simple_work_queue (queue_table[i]); -UDS_FREE (queue_table); -UDS_FREE (queue->common.name); -UDS_FREE (queue); +uds_free (queue_table); +uds_free (queue->common.name); +uds_free (queue); }void vdo_free_work_queue (struct vdo_work_queue *queue)
@@ -340,7 +340,7 @@ static int make_simple_work_queue(const char *thread_name_prefix, result =uds_duplicate_string (name,"queue name" , &queue->common.name);if (result !=VDO_SUCCESS ) { -UDS_FREE (queue); +uds_free (queue);return -ENOMEM ; }
@@ -423,7 +423,7 @@ int vdo_make_work_queue(const char *thread_name_prefix,"subordinate work queues" , &queue->service_queues);if (result !=UDS_SUCCESS ) { -UDS_FREE (queue); +uds_free (queue);return result; }
@@ -433,8 +433,8 @@ int vdo_make_work_queue(const char *thread_name_prefix, result =uds_duplicate_string (name,"queue name" , &queue->common.name);if (result !=VDO_SUCCESS ) { -UDS_FREE (queue->service_queues); -UDS_FREE (queue); +uds_free (queue->service_queues); +uds_free (queue);return -ENOMEM ; }
drivers/md/dm-vdo/geometry.c +1 -1
@@ -123,7 +123,7 @@ int uds_copy_geometry(struct geometry *source, struct geometry **geometry_ptr)void uds_free_geometry (struct geometry *geometry) { -UDS_FREE (geometry); +uds_free (geometry); }u32 __must_check uds_map_to_physical_chapter (const struct geometry *geometry,u64 virtual_chapter)
drivers/md/dm-vdo/index-layout.c +20 -20
@@ -573,7 +573,7 @@ static int __must_check write_index_save_header(struct index_save_layout *isl, } result =uds_write_to_buffered_writer (writer, buffer, offset); -UDS_FREE (buffer); +uds_free (buffer);if (result !=UDS_SUCCESS )return result;
@@ -592,12 +592,12 @@ static int write_index_save_layout(struct index_layout *layout, struct index_sav result =open_region_writer (layout, &isl->header, &writer);if (result !=UDS_SUCCESS ) { -UDS_FREE (table); +uds_free (table);return result; } result =write_index_save_header (isl, table, writer); -UDS_FREE (table); +uds_free (table);uds_free_buffered_writer (writer);return result;
@@ -747,7 +747,7 @@ static int __must_check write_layout_header(struct index_layout *layout, } result =uds_write_to_buffered_writer (writer, buffer, offset); -UDS_FREE (buffer); +uds_free (buffer);if (result !=UDS_SUCCESS )return result;
@@ -793,12 +793,12 @@ static int __must_check save_layout(struct index_layout *layout, off_t offset) result =open_layout_writer (layout, &layout->header, offset, &writer);if (result !=UDS_SUCCESS ) { -UDS_FREE (table); +uds_free (table);return result; } result =write_layout_header (layout, table, writer); -UDS_FREE (table); +uds_free (table);uds_free_buffered_writer (writer);return result;
@@ -1192,7 +1192,7 @@ load_region_table(struct buffered_reader *reader, struct region_table **table_pt region_buffer, sizeof(region_buffer));if (result !=UDS_SUCCESS ) { -UDS_FREE (table); +uds_free (table);return uds_log_error_strerror (UDS_CORRUPT_DATA ,"cannot read region table layouts" ); }
@@ -1223,7 +1223,7 @@ static int __must_check read_super_block_data(struct buffered_reader *reader, result =uds_read_from_buffered_reader (reader, buffer, saved_size);if (result !=UDS_SUCCESS ) { -UDS_FREE (buffer); +uds_free (buffer);return uds_log_error_strerror (result,"cannot read region table header" ); }
@@ -1248,7 +1248,7 @@ static int __must_check read_super_block_data(struct buffered_reader *reader, super->start_offset =0 ; } -UDS_FREE (buffer); +uds_free (buffer);if (memcmp (super->magic_label,LAYOUT_MAGIC ,MAGIC_SIZE ) !=0 )return uds_log_error_strerror (UDS_CORRUPT_DATA ,"unknown superblock magic label" );
@@ -1398,18 +1398,18 @@ static int __must_check load_super_block(struct index_layout *layout,return result;if (table->header.type !=RH_TYPE_SUPER ) { -UDS_FREE (table); +uds_free (table);return uds_log_error_strerror (UDS_CORRUPT_DATA ,"not a superblock region table" ); } result =read_super_block_data (reader, layout, table->header.payload);if (result !=UDS_SUCCESS ) { -UDS_FREE (table); +uds_free (table);return uds_log_error_strerror (result,"unknown superblock format" ); }if (super->block_size != block_size) { -UDS_FREE (table); +uds_free (table); return uds_log_error_strerror(UDS_CORRUPT_DATA, "superblock saved block_size %u differs from supplied block_size %zu", super->block_size,
@@ -1418,7 +1418,7 @@ static int __must_check load_super_block(struct index_layout *layout, first_block -= (super->volume_offset - super->start_offset); result =reconstitute_layout (layout, table, first_block); -UDS_FREE (table); +uds_free (table);return result; }
@@ -1557,7 +1557,7 @@ static int __must_check load_index_save(struct index_save_layout *isl,if (table->header.region_blocks != isl->index_save.block_count) {u64 region_blocks = table->header.region_blocks; -UDS_FREE (table); +uds_free (table); return uds_log_error_strerror(UDS_CORRUPT_DATA, "unexpected index save %u region block count %llu", instance,
@@ -1565,14 +1565,14 @@ static int __must_check load_index_save(struct index_save_layout *isl, }if (table->header.type ==RH_TYPE_UNSAVED ) { -UDS_FREE (table); +uds_free (table);reset_index_save_layout (isl,0 );return UDS_SUCCESS ; }if (table->header.type !=RH_TYPE_SAVE ) { -UDS_FREE (table); +uds_free (table); return uds_log_error_strerror(UDS_CORRUPT_DATA, "unexpected index save %u header type %u", instance,
@@ -1581,14 +1581,14 @@ static int __must_check load_index_save(struct index_save_layout *isl, result =read_index_save_data (reader, isl, table->header.payload);if (result !=UDS_SUCCESS ) { -UDS_FREE (table); +uds_free (table);return uds_log_error_strerror (result,"unknown index save %u data format" , instance); } result =reconstruct_index_save (isl, table); -UDS_FREE (table); +uds_free (table);if (result !=UDS_SUCCESS ) return uds_log_error_strerror(result, "cannot reconstruct index save %u",
@@ -1744,11 +1744,11 @@ void uds_free_index_layout(struct index_layout *layout)if (layout ==NULL )return ; -UDS_FREE (layout->index.saves); +uds_free (layout->index.saves);if (layout->factory !=NULL )uds_put_io_factory (layout->factory); -UDS_FREE (layout); +uds_free (layout); }int uds_replace_index_layout_storage (struct index_layout *layout,struct block_device *bdev)
drivers/md/dm-vdo/index-page-map.c +6 -6
@@ -60,8 +60,8 @@ int uds_make_index_page_map(const struct geometry *geometry, struct index_page_mvoid uds_free_index_page_map (struct index_page_map *map) {if (map !=NULL ) { -UDS_FREE (map->entries); -UDS_FREE (map); +uds_free (map->entries); +uds_free (map); } }
@@ -137,7 +137,7 @@ int uds_write_index_page_map(struct index_page_map *map, struct buffered_writerencode_u16_le (buffer, &offset, map->entries[i]); result =uds_write_to_buffered_writer (writer, buffer, offset); -UDS_FREE (buffer); +uds_free (buffer);if (result !=UDS_SUCCESS )return result;
@@ -159,14 +159,14 @@ int uds_read_index_page_map(struct index_page_map *map, struct buffered_reader * result =uds_read_from_buffered_reader (reader, buffer, saved_size);if (result !=UDS_SUCCESS ) { -UDS_FREE (buffer); +uds_free (buffer);return result; }memcpy (&magic, buffer,PAGE_MAP_MAGIC_LENGTH ); offset +=PAGE_MAP_MAGIC_LENGTH ;if (memcmp (magic,PAGE_MAP_MAGIC ,PAGE_MAP_MAGIC_LENGTH ) !=0 ) { -UDS_FREE (buffer); +uds_free (buffer);return UDS_CORRUPT_DATA ; }
@@ -174,7 +174,7 @@ int uds_read_index_page_map(struct index_page_map *map, struct buffered_reader *for (i =0 ; i <get_entry_count (map->geometry); i++)decode_u16_le (buffer, &offset, &map->entries[i]); -UDS_FREE (buffer); +uds_free (buffer);uds_log_debug ("read index page map, last update %llu" , (unsigned long long ) map->last_update);return UDS_SUCCESS ;
drivers/md/dm-vdo/index-session.c +6 -6
@@ -224,14 +224,14 @@ static int __must_check make_empty_index_session(struct uds_index_session **inde result =uds_init_mutex (&session->request_mutex);if (result !=UDS_SUCCESS ) { -UDS_FREE (session); +uds_free (session);return result; } result =uds_init_cond (&session->request_cond);if (result !=UDS_SUCCESS ) {uds_destroy_mutex (&session->request_mutex); -UDS_FREE (session); +uds_free (session);return result; }
@@ -239,7 +239,7 @@ static int __must_check make_empty_index_session(struct uds_index_session **indeif (result !=UDS_SUCCESS ) {uds_destroy_cond (&session->request_cond);uds_destroy_mutex (&session->request_mutex); -UDS_FREE (session); +uds_free (session);return result; }
@@ -248,7 +248,7 @@ static int __must_check make_empty_index_session(struct uds_index_session **indeuds_destroy_mutex (&session->load_context.mutex);uds_destroy_cond (&session->request_cond);uds_destroy_mutex (&session->request_mutex); -UDS_FREE (session); +uds_free (session);return result; }
@@ -258,7 +258,7 @@ static int __must_check make_empty_index_session(struct uds_index_session **indeuds_destroy_mutex (&session->load_context.mutex);uds_destroy_cond (&session->request_cond);uds_destroy_mutex (&session->request_mutex); -UDS_FREE (session); +uds_free (session);return result; }
@@ -691,7 +691,7 @@ int uds_destroy_index_session(struct uds_index_session *index_session)uds_destroy_cond (&index_session->request_cond);uds_destroy_mutex (&index_session->request_mutex);uds_log_debug ("Destroyed index session" ); -UDS_FREE (index_session); +uds_free (index_session);return uds_map_to_system_error (result); }
drivers/md/dm-vdo/index.c +8 -8
@@ -623,7 +623,7 @@ static void execute_zone_request(struct uds_request *request) request->zone_message.type);/* Once the message is processed it can be freed. */ -UDS_FREE (uds_forget (request)); +uds_free (uds_forget (request));return ; }
@@ -756,8 +756,8 @@ static void free_chapter_writer(struct chapter_writer *writer)uds_destroy_mutex (&writer->mutex);uds_destroy_cond (&writer->cond);uds_free_open_chapter_index (writer->open_chapter_index); -UDS_FREE (writer->collated_records); -UDS_FREE (writer); +uds_free (writer->collated_records); +uds_free (writer); }static int make_chapter_writer (struct uds_index *index,struct chapter_writer **writer_ptr)
@@ -778,14 +778,14 @@ static int make_chapter_writer(struct uds_index *index, struct chapter_writer ** writer->index = index; result =uds_init_mutex (&writer->mutex);if (result !=UDS_SUCCESS ) { -UDS_FREE (writer); +uds_free (writer);return result; } result =uds_init_cond (&writer->cond);if (result !=UDS_SUCCESS ) {uds_destroy_mutex (&writer->mutex); -UDS_FREE (writer); +uds_free (writer);return result; }
@@ -1129,7 +1129,7 @@ static void free_index_zone(struct index_zone *zone)uds_free_open_chapter (zone->open_chapter);uds_free_open_chapter (zone->writing_chapter); -UDS_FREE (zone); +uds_free (zone); }static int make_index_zone (struct uds_index *index,unsigned int zone_number)
@@ -1304,12 +1304,12 @@ void uds_free_index(struct uds_index *index)if (index->zones !=NULL ) {for (i =0 ; i < index->zone_count; i++)free_index_zone (index->zones[i]); -UDS_FREE (index->zones); +uds_free (index->zones); }uds_free_volume (index->volume);uds_free_index_layout (uds_forget (index->layout)); -UDS_FREE (index); +uds_free (index); }/* Wait for the chapter writer to complete any outstanding writes. */
drivers/md/dm-vdo/int-map.c +4 -4
@@ -227,8 +227,8 @@ void vdo_free_int_map(struct int_map *map)if (map ==NULL )return ; -UDS_FREE (uds_forget (map->buckets)); -UDS_FREE (uds_forget (map)); +uds_free (uds_forget (map->buckets)); +uds_free (uds_forget (map)); }/**
@@ -408,14 +408,14 @@ static int resize_buckets(struct int_map *map) result =vdo_int_map_put (map, entry->key, entry->value, true,NULL );if (result !=UDS_SUCCESS ) {/* Destroy the new partial map and restore the map from the stack. */ -UDS_FREE (uds_forget (map->buckets)); +uds_free (uds_forget (map->buckets)); *map = old_map;return result; } }/* Destroy the old bucket array. */ -UDS_FREE (uds_forget (old_map.buckets)); +uds_free (uds_forget (old_map.buckets));return UDS_SUCCESS ; }
drivers/md/dm-vdo/io-factory.c +3 -3
@@ -85,7 +85,7 @@ int uds_replace_storage(struct io_factory *factory, struct block_device *bdev)void uds_put_io_factory (struct io_factory *factory) {if (atomic_add_return (-1 , &factory->ref_count) <=0 ) -UDS_FREE (factory); +uds_free (factory); }size_t uds_get_writable_size (struct io_factory *factory)
@@ -137,7 +137,7 @@ void uds_free_buffered_reader(struct buffered_reader *reader)dm_bufio_client_destroy (reader->client);uds_put_io_factory (reader->factory); -UDS_FREE (reader); +uds_free (reader); }/* Create a buffered reader for an index region starting at offset. */
@@ -378,7 +378,7 @@ void uds_free_buffered_writer(struct buffered_writer *writer)dm_bufio_client_destroy (writer->client);uds_put_io_factory (writer->factory); -UDS_FREE (writer); +uds_free (writer); }/*
drivers/md/dm-vdo/io-submitter.c +1 -1
@@ -479,5 +479,5 @@ void vdo_free_io_submitter(struct io_submitter *io_submitter)uds_forget (io_submitter->bio_queue_data[i].queue);vdo_free_int_map (uds_forget (io_submitter->bio_queue_data[i].map)); } -UDS_FREE (io_submitter); +uds_free (io_submitter); }
drivers/md/dm-vdo/logical-zone.c +2 -2
@@ -137,12 +137,12 @@ void vdo_free_logical_zones(struct logical_zones *zones)if (zones ==NULL )return ; -UDS_FREE (uds_forget (zones->manager)); +uds_free (uds_forget (zones->manager));for (index =0 ; index < zones->zone_count; index++)vdo_free_int_map (uds_forget (zones->zones[index].lbn_operations)); -UDS_FREE (zones); +uds_free (zones); }static inline void assert_on_zone_thread (struct logical_zone *zone,const char *what)
drivers/md/dm-vdo/memory-alloc.c +4 -4
@@ -149,7 +149,7 @@ static void remove_vmalloc_block(void *ptr)spin_unlock_irqrestore (&memory_stats.lock, flags);if (block !=NULL ) -UDS_FREE (block); +uds_free (block);else uds_log_info ("attempting to remove ptr %px not found in vmalloc list" , ptr); }
@@ -274,7 +274,7 @@ int uds_allocate_memory(size_t size, size_t align, const char *what, void *ptr) }if (p ==NULL ) { -UDS_FREE (block); +uds_free (block); }else { block->ptr = p; block->size =PAGE_ALIGN (size);
@@ -349,7 +349,7 @@ int uds_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *wint result;if (size ==0 ) { -UDS_FREE (ptr); +uds_free (ptr); *(void **) new_ptr =NULL ;return UDS_SUCCESS ; }
@@ -363,7 +363,7 @@ int uds_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *w size = old_size;memcpy (*((void **) new_ptr), ptr, size); -UDS_FREE (ptr); +uds_free (ptr); }return UDS_SUCCESS ;
drivers/md/dm-vdo/memory-alloc.h +1 -1
@@ -19,7 +19,7 @@ int __must_check uds_allocate_memory(size_t size, size_t align, const char *whatvoid uds_free_memory (void *ptr);/* Free memory allocated with UDS_ALLOCATE(). */ -#define UDS_FREE (PTR ) uds_free_memory(PTR) +#define uds_free (PTR ) uds_free_memory(PTR)static inline void *__uds_forget (void **ptr_ptr) {
drivers/md/dm-vdo/message-stats.c +1 -1
@@ -1210,6 +1210,6 @@ int vdo_write_stats(struct vdo *vdo,vdo_fetch_statistics (vdo, stats); result =write_vdo_statistics (NULL , stats,NULL , &buf, &maxlen); -UDS_FREE (stats); +uds_free (stats);return result; }
drivers/md/dm-vdo/open-chapter.c +2 -2
@@ -200,8 +200,8 @@ void uds_remove_from_open_chapter(struct open_chapter_zone *open_chapter,void uds_free_open_chapter (struct open_chapter_zone *open_chapter) {if (open_chapter !=NULL ) { -UDS_FREE (open_chapter->records); -UDS_FREE (open_chapter); +uds_free (open_chapter->records); +uds_free (open_chapter); } }
drivers/md/dm-vdo/packer.c +3 -3
@@ -206,11 +206,11 @@ void vdo_free_packer(struct packer *packer)list_for_each_entry_safe (bin, tmp, &packer->bins, list) {list_del_init (&bin->list); -UDS_FREE (bin); +uds_free (bin); } -UDS_FREE (uds_forget (packer->canceled_bin)); -UDS_FREE (packer); +uds_free (uds_forget (packer->canceled_bin)); +uds_free (packer); }/**
drivers/md/dm-vdo/physical-zone.c +2 -2
@@ -275,7 +275,7 @@ static void free_pbn_lock_pool(struct pbn_lock_pool *pool)ASSERT_LOG_ONLY (pool->borrowed ==0 ,"All PBN locks must be returned to the pool before it is freed, but %zu locks are still on loan" , pool->borrowed); -UDS_FREE (pool); +uds_free (pool); }/**
@@ -410,7 +410,7 @@ void vdo_free_physical_zones(struct physical_zones *zones)vdo_free_int_map (uds_forget (zone->pbn_operations)); } -UDS_FREE (zones); +uds_free (zones); }/**
drivers/md/dm-vdo/pointer-map.c +4 -4
@@ -197,8 +197,8 @@ void vdo_free_pointer_map(struct pointer_map *map)if (map ==NULL )return ; -UDS_FREE (uds_forget (map->buckets)); -UDS_FREE (uds_forget (map)); +uds_free (uds_forget (map->buckets)); +uds_free (uds_forget (map)); }/**
@@ -369,14 +369,14 @@ static int resize_buckets(struct pointer_map *map) result =vdo_pointer_map_put (map, entry->key, entry->value, true,NULL );if (result !=UDS_SUCCESS ) {/* Destroy the new partial map and restore the map from the stack. */ -UDS_FREE (uds_forget (map->buckets)); +uds_free (uds_forget (map->buckets)); *map = old_map;return result; } }/* Destroy the old bucket array. */ -UDS_FREE (uds_forget (old_map.buckets)); +uds_free (uds_forget (old_map.buckets));return UDS_SUCCESS ; }
drivers/md/dm-vdo/pool-sysfs.c +1 -1
@@ -105,7 +105,7 @@ static ssize_t pool_requests_maximum_show(struct vdo *vdo, char *buf)static void vdo_pool_release (struct kobject *directory) { -UDS_FREE (container_of(directory ,struct vdo ,vdo_directory )); +uds_free (container_of(directory ,struct vdo ,vdo_directory )); }static struct pool_attribute vdo_pool_compressing_attr = {
drivers/md/dm-vdo/priority-table.c +1 -1
@@ -98,7 +98,7 @@ void vdo_free_priority_table(struct priority_table *table)*/ vdo_reset_priority_table (table); -UDS_FREE (table); +uds_free (table); }/**
drivers/md/dm-vdo/radix-sort.c +1 -1
@@ -236,7 +236,7 @@ int uds_make_radix_sorter(unsigned int count, struct radix_sorter **sorter)void uds_free_radix_sorter (struct radix_sorter *sorter) { -UDS_FREE (sorter); +uds_free (sorter); }/*
drivers/md/dm-vdo/recovery-journal.c +9 -9
@@ -689,7 +689,7 @@ static int initialize_recovery_block(struct vdo *vdo, data, &block->vio);if (result !=VDO_SUCCESS ) { -UDS_FREE (data); +uds_free (data);return result; }
@@ -808,12 +808,12 @@ void vdo_free_recovery_journal(struct recovery_journal *journal)if (journal ==NULL )return ; -UDS_FREE (uds_forget (journal->lock_counter.logical_zone_counts)); -UDS_FREE (uds_forget (journal->lock_counter.physical_zone_counts)); -UDS_FREE (uds_forget (journal->lock_counter.journal_counters)); -UDS_FREE (uds_forget (journal->lock_counter.journal_decrement_counts)); -UDS_FREE (uds_forget (journal->lock_counter.logical_counters)); -UDS_FREE (uds_forget (journal->lock_counter.physical_counters)); +uds_free (uds_forget (journal->lock_counter.logical_zone_counts)); +uds_free (uds_forget (journal->lock_counter.physical_zone_counts)); +uds_free (uds_forget (journal->lock_counter.journal_counters)); +uds_free (uds_forget (journal->lock_counter.journal_decrement_counts)); +uds_free (uds_forget (journal->lock_counter.logical_counters)); +uds_free (uds_forget (journal->lock_counter.physical_counters));free_vio (uds_forget (journal->flush_vio));/*
@@ -829,11 +829,11 @@ void vdo_free_recovery_journal(struct recovery_journal *journal)for (i =0 ; i <RECOVERY_JOURNAL_RESERVED_BLOCKS ; i++) {struct recovery_journal_block *block = &journal->blocks[i]; -UDS_FREE (uds_forget (block->vio.data)); +uds_free (uds_forget (block->vio.data));free_vio_components (&block->vio); } -UDS_FREE (journal); +uds_free (journal); }/**
drivers/md/dm-vdo/repair.c +5 -5
@@ -229,7 +229,7 @@ static void uninitialize_vios(struct repair_completion *repair)while (repair->vio_count >0 )free_vio_components (&repair->vios[--repair->vio_count]); -UDS_FREE (uds_forget (repair->vios)); +uds_free (uds_forget (repair->vios)); }static void free_repair_completion (struct repair_completion *repair)
@@ -244,9 +244,9 @@ static void free_repair_completion(struct repair_completion *repair) repair->completion.vdo->block_map->zones[0 ].page_cache.rebuilding = false;uninitialize_vios (repair); -UDS_FREE (uds_forget (repair->journal_data)); -UDS_FREE (uds_forget (repair->entries)); -UDS_FREE (repair); +uds_free (uds_forget (repair->journal_data)); +uds_free (uds_forget (repair->entries)); +uds_free (repair); }static void finish_repair (struct vdo_completion *completion)
@@ -1120,7 +1120,7 @@ static void recover_block_map(struct vdo_completion *completion)if (repair->block_map_entry_count ==0 ) {uds_log_info ("Replaying 0 recovery entries into block map" ); -UDS_FREE (uds_forget (repair->journal_data)); +uds_free (uds_forget (repair->journal_data));launch_repair_completion (repair, load_slab_depot,VDO_ZONE_TYPE_ADMIN );return ; }
drivers/md/dm-vdo/slab-depot.c +17 -17
@@ -2439,7 +2439,7 @@ static int allocate_slab_counters(struct vdo_slab *slab) bytes = (slab->reference_block_count *COUNTS_PER_BLOCK ) + (2 *BYTES_PER_WORD ); result =UDS_ALLOCATE (bytes, vdo_refcount_t,"ref counts array" , &slab->counters);if (result !=UDS_SUCCESS ) { -UDS_FREE (uds_forget (slab->reference_blocks)); +uds_free (uds_forget (slab->reference_blocks));return result; }
@@ -2715,7 +2715,7 @@ static bool __must_check has_slabs_to_scrub(struct slab_scrubber *scrubber)*/ static void uninitialize_scrubber_vio (struct slab_scrubber *scrubber) { -UDS_FREE (uds_forget (scrubber->vio.data)); +uds_free (uds_forget (scrubber->vio.data));free_vio_components (&scrubber->vio); }
@@ -3616,7 +3616,7 @@ vdo_prepare_slabs_for_allocation(struct block_allocator *allocator)register_slab_for_scrubbing (slab, high_priority); } -UDS_FREE (slab_statuses); +uds_free (slab_statuses);return VDO_SUCCESS ; }
@@ -3713,11 +3713,11 @@ static void free_slab(struct vdo_slab *slab)return ;list_del (&slab->allocq_entry); -UDS_FREE (uds_forget (slab->journal.block)); -UDS_FREE (uds_forget (slab->journal.locks)); -UDS_FREE (uds_forget (slab->counters)); -UDS_FREE (uds_forget (slab->reference_blocks)); -UDS_FREE (slab); +uds_free (uds_forget (slab->journal.block)); +uds_free (uds_forget (slab->journal.locks)); +uds_free (uds_forget (slab->counters)); +uds_free (uds_forget (slab->reference_blocks)); +uds_free (slab); }static int initialize_slab_journal (struct vdo_slab *slab)
@@ -3900,7 +3900,7 @@ void vdo_abandon_new_slabs(struct slab_depot *depot)free_slab (uds_forget (depot->new_slabs[i])); depot->new_slab_count =0 ; depot->new_size =0 ; -UDS_FREE (uds_forget (depot->new_slabs)); +uds_free (uds_forget (depot->new_slabs)); }/**
@@ -4022,7 +4022,7 @@ static int initialize_slab_scrubber(struct block_allocator *allocator) journal_data, &scrubber->vio);if (result !=VDO_SUCCESS ) { -UDS_FREE (journal_data); +uds_free (journal_data);return result; }
@@ -4299,10 +4299,10 @@ static void uninitialize_allocator_summary(struct block_allocator *allocator)for (i =0 ; i <VDO_SLAB_SUMMARY_BLOCKS_PER_ZONE ; i++) {free_vio_components (&allocator->summary_blocks[i].vio); -UDS_FREE (uds_forget (allocator->summary_blocks[i].outgoing_entries)); +uds_free (uds_forget (allocator->summary_blocks[i].outgoing_entries)); } -UDS_FREE (uds_forget (allocator->summary_blocks)); +uds_free (uds_forget (allocator->summary_blocks)); }/**
@@ -4337,10 +4337,10 @@ void vdo_free_slab_depot(struct slab_depot *depot)free_slab (uds_forget (depot->slabs[i])); } -UDS_FREE (uds_forget (depot->slabs)); -UDS_FREE (uds_forget (depot->action_manager)); -UDS_FREE (uds_forget (depot->summary_entries)); -UDS_FREE (depot); +uds_free (uds_forget (depot->slabs)); +uds_free (uds_forget (depot->action_manager)); +uds_free (uds_forget (depot->summary_entries)); +uds_free (depot); }/**
@@ -4804,7 +4804,7 @@ static int finish_registration(void *context)struct slab_depot *depot = context;WRITE_ONCE (depot->slab_count, depot->new_slab_count); -UDS_FREE (depot->slabs); +uds_free (depot->slabs); depot->slabs = depot->new_slabs; depot->new_slabs =NULL ; depot->new_slab_count =0 ;
drivers/md/dm-vdo/sparse-cache.c +5 -5
@@ -308,20 +308,20 @@ void uds_free_sparse_cache(struct sparse_cache *cache)if (cache ==NULL )return ; -UDS_FREE (cache->scratch_entries); +uds_free (cache->scratch_entries);for (i =0 ; i < cache->zone_count; i++) -UDS_FREE (cache->search_lists[i]); +uds_free (cache->search_lists[i]);for (i =0 ; i < cache->capacity; i++) {release_cached_chapter_index (&cache->chapters[i]); -UDS_FREE (cache->chapters[i].index_pages); -UDS_FREE (cache->chapters[i].page_buffers); +uds_free (cache->chapters[i].index_pages); +uds_free (cache->chapters[i].page_buffers); }uds_destroy_barrier (&cache->begin_update_barrier);uds_destroy_barrier (&cache->end_update_barrier); -UDS_FREE (cache); +uds_free (cache); }/*
drivers/md/dm-vdo/uds-sysfs.c +1 -1
@@ -117,7 +117,7 @@ parameter_store(struct kobject *kobj, struct attribute *attr, const char *buf, sreturn -ENOMEM ; pa->store_string (string); -UDS_FREE (string); +uds_free (string);return length; }
drivers/md/dm-vdo/uds-threads.c +2 -2
@@ -119,7 +119,7 @@ int uds_create_thread(void (*thread_function)(void *), task =kthread_run (thread_starter, thread,"%s" , name);if (IS_ERR (task)) { -UDS_FREE (thread); +uds_free (thread);return PTR_ERR (task); }
@@ -136,7 +136,7 @@ int uds_join_threads(struct thread *thread)mutex_lock (&thread_mutex);hlist_del (&thread->thread_links);mutex_unlock (&thread_mutex); -UDS_FREE (thread); +uds_free (thread);return UDS_SUCCESS ; }
drivers/md/dm-vdo/vdo.c +14 -14
@@ -173,10 +173,10 @@ static const struct vdo_work_queue_type cpu_q_type = {static void uninitialize_thread_config (struct thread_config *config) { -UDS_FREE (uds_forget (config->logical_threads)); -UDS_FREE (uds_forget (config->physical_threads)); -UDS_FREE (uds_forget (config->hash_zone_threads)); -UDS_FREE (uds_forget (config->bio_threads)); +uds_free (uds_forget (config->logical_threads)); +uds_free (uds_forget (config->physical_threads)); +uds_free (uds_forget (config->hash_zone_threads)); +uds_free (uds_forget (config->bio_threads));memset (config,0 ,sizeof (struct thread_config )); }
@@ -291,7 +291,7 @@ static int __must_check read_geometry_block(struct vdo *vdo) result =create_metadata_vio (vdo,VIO_TYPE_GEOMETRY ,VIO_PRIORITY_HIGH ,NULL , block, &vio);if (result !=VDO_SUCCESS ) { -UDS_FREE (block); +uds_free (block);return result; }
@@ -303,7 +303,7 @@ static int __must_check read_geometry_block(struct vdo *vdo) result =vio_reset_bio (vio, block,NULL ,REQ_OP_READ ,VDO_GEOMETRY_BLOCK_LOCATION );if (result !=VDO_SUCCESS ) {free_vio (uds_forget (vio)); -UDS_FREE (block); +uds_free (block);return result; }
@@ -313,12 +313,12 @@ static int __must_check read_geometry_block(struct vdo *vdo)free_vio (uds_forget (vio));if (result !=0 ) {uds_log_error_strerror (result,"synchronous read failed" ); -UDS_FREE (block); +uds_free (block);return -EIO ; } result =vdo_parse_geometry_block ((u8 *) block, &vdo->geometry); -UDS_FREE (block); +uds_free (block);return result; }
@@ -703,14 +703,14 @@ static void free_listeners(struct vdo_thread *thread)for (listener =uds_forget (thread->listeners); listener !=NULL ; listener = next) { next =uds_forget (listener->next); -UDS_FREE (listener); +uds_free (listener); } }static void uninitialize_super_block (struct vdo_super_block *super_block) {free_vio_components (&super_block->vio); -UDS_FREE (super_block->buffer); +uds_free (super_block->buffer); }/**
@@ -772,16 +772,16 @@ void vdo_destroy(struct vdo *vdo)free_listeners (&vdo->threads[i]);vdo_free_work_queue (uds_forget (vdo->threads[i].queue)); } -UDS_FREE (uds_forget (vdo->threads)); +uds_free (uds_forget (vdo->threads)); }uninitialize_thread_config (&vdo->thread_config);if (vdo->compression_context !=NULL ) {for (i =0 ; i < vdo->device_config->thread_counts.cpu_threads; i++) -UDS_FREE (uds_forget (vdo->compression_context[i])); +uds_free (uds_forget (vdo->compression_context[i])); -UDS_FREE (uds_forget (vdo->compression_context)); +uds_free (uds_forget (vdo->compression_context)); }/*
@@ -789,7 +789,7 @@ void vdo_destroy(struct vdo *vdo)* the count goes to zero the VDO object will be freed as a side effect. */ if (!vdo->sysfs_added) -UDS_FREE (vdo); +uds_free (vdo);else kobject_put (&vdo->vdo_directory); }
drivers/md/dm-vdo/vio.c +5 -5
@@ -71,7 +71,7 @@ void vdo_free_bio(struct bio *bio)return ;bio_uninit (bio); -UDS_FREE (uds_forget (bio)); +uds_free (uds_forget (bio)); } int allocate_vio_components(struct vdo *vdo,
@@ -146,7 +146,7 @@ int create_multi_block_metadata_vio(struct vdo *vdo, result =allocate_vio_components (vdo, vio_type, priority, parent, block_count, data, vio);if (result !=VDO_SUCCESS ) { -UDS_FREE (vio); +uds_free (vio);return result; }
@@ -174,7 +174,7 @@ void free_vio_components(struct vio *vio)void free_vio (struct vio *vio) {free_vio_components (vio); -UDS_FREE (vio); +uds_free (vio); }/* Set bio properties for a VDO read or write. */
@@ -405,8 +405,8 @@ void free_vio_pool(struct vio_pool *pool)ASSERT_LOG_ONLY (pool->size ==0 ,"VIO pool must not have missing entries when being freed" ); -UDS_FREE (uds_forget (pool->buffer)); -UDS_FREE (pool); +uds_free (uds_forget (pool->buffer)); +uds_free (pool); }/**
drivers/md/dm-vdo/volume-index.c +4 -4
@@ -272,8 +272,8 @@ static int compute_volume_sub_index_parameters(const struct configuration *confistatic void uninitialize_volume_sub_index (struct volume_sub_index *sub_index) { -UDS_FREE (uds_forget (sub_index->flush_chapters)); -UDS_FREE (uds_forget (sub_index->zones)); +uds_free (uds_forget (sub_index->flush_chapters)); +uds_free (uds_forget (sub_index->zones));uds_uninitialize_delta_index (&sub_index->delta_index); }
@@ -287,12 +287,12 @@ void uds_free_volume_index(struct volume_index *volume_index)for (zone =0 ; zone < volume_index->zone_count; zone++)uds_destroy_mutex (&volume_index->zones[zone].hook_mutex); -UDS_FREE (uds_forget (volume_index->zones)); +uds_free (uds_forget (volume_index->zones)); }uninitialize_volume_sub_index (&volume_index->vi_non_hook);uninitialize_volume_sub_index (&volume_index->vi_hook); -UDS_FREE (volume_index); +uds_free (volume_index); }
drivers/md/dm-vdo/volume.c +8 -8
@@ -1751,10 +1751,10 @@ static void uninitialize_page_cache(struct page_cache *cache)for (i =0 ; i < cache->cache_slots; i++)release_page_buffer (&cache->cache[i]); } -UDS_FREE (cache->index); -UDS_FREE (cache->cache); -UDS_FREE (cache->search_pending_counters); -UDS_FREE (cache->read_queue); +uds_free (cache->index); +uds_free (cache->cache); +uds_free (cache->search_pending_counters); +uds_free (cache->read_queue); }void uds_free_volume (struct volume *volume)
@@ -1772,7 +1772,7 @@ void uds_free_volume(struct volume *volume)uds_unlock_mutex (&volume->read_threads_mutex);for (i =0 ; i < volume->read_thread_count; i++)uds_join_threads (volume->reader_threads[i]); -UDS_FREE (volume->reader_threads); +uds_free (volume->reader_threads); volume->reader_threads =NULL ; }
@@ -1787,7 +1787,7 @@ void uds_free_volume(struct volume *volume)uds_destroy_mutex (&volume->read_threads_mutex);uds_free_index_page_map (volume->index_page_map);uds_free_radix_sorter (volume->radix_sorter); -UDS_FREE (volume->geometry); -UDS_FREE (volume->record_pointers); -UDS_FREE (volume); +uds_free (volume->geometry); +uds_free (volume->record_pointers); +uds_free (volume); }
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 4/8 dm vdo memory-alloc: rename UDS_ALLOCATE to uds_allocate
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo-target.c | 10 +++++----- drivers/md/dm-vdo/action-manager.c | 2 +- drivers/md/dm-vdo/block-map.c | 10 +++++----- drivers/md/dm-vdo/chapter-index.c | 2 +- drivers/md/dm-vdo/config.c | 2 +- drivers/md/dm-vdo/dedupe.c | 2 +- drivers/md/dm-vdo/delta-index.c | 10 +++++----- drivers/md/dm-vdo/encodings.c | 2 +- drivers/md/dm-vdo/flush.c | 4 ++-- drivers/md/dm-vdo/funnel-queue.c | 2 +- drivers/md/dm-vdo/funnel-requestqueue.c | 2 +- drivers/md/dm-vdo/funnel-workqueue.c | 6 +++--- drivers/md/dm-vdo/geometry.c | 2 +- drivers/md/dm-vdo/index-layout.c | 12 ++++++------ drivers/md/dm-vdo/index-page-map.c | 8 ++++---- drivers/md/dm-vdo/index-session.c | 2 +- drivers/md/dm-vdo/index.c | 6 +++--- drivers/md/dm-vdo/int-map.c | 4 ++-- drivers/md/dm-vdo/io-factory.c | 6 +++--- drivers/md/dm-vdo/memory-alloc.c | 6 +++--- drivers/md/dm-vdo/memory-alloc.h | 4 ++-- drivers/md/dm-vdo/message-stats.c | 2 +- drivers/md/dm-vdo/packer.c | 2 +- drivers/md/dm-vdo/pointer-map.c | 4 ++-- drivers/md/dm-vdo/recovery-journal.c | 14 +++++++------- drivers/md/dm-vdo/repair.c | 8 ++++---- drivers/md/dm-vdo/slab-depot.c | 22 +++++++++++----------- drivers/md/dm-vdo/slab-depot.h | 2 +- drivers/md/dm-vdo/sparse-cache.c | 6 +++--- drivers/md/dm-vdo/uds-sysfs.c | 2 +- drivers/md/dm-vdo/uds-threads.c | 2 +- drivers/md/dm-vdo/vdo.c | 22 +++++++++++----------- drivers/md/dm-vdo/vio.c | 4 ++-- drivers/md/dm-vdo/volume-index.c | 8 ++++---- drivers/md/dm-vdo/volume.c | 14 +++++++------- 35 files changed, 108 insertions(+), 108 deletions(-)
drivers/md/dm-vdo-target.c +5 -5
@@ -280,7 +280,7 @@ static int split_string(const char *string, char separator, char ***substring_arif (*s == separator) substring_count++; - result = UDS_ALLOCATE(substring_count + 1, char *, "string-splitting array", &substrings); + result = uds_allocate(substring_count + 1, char *, "string-splitting array", &substrings);if (result !=UDS_SUCCESS )return result;
@@ -288,7 +288,7 @@ static int split_string(const char *string, char separator, char ***substring_arif (*s == separator) {ptrdiff_t length = s - string; - result =UDS_ALLOCATE (length +1 , + result =uds_allocate (length +1 , char,"split string" , &substrings[current_substring]);
@@ -311,7 +311,7 @@ static int split_string(const char *string, char separator, char ***substring_arBUG_ON (current_substring != (substring_count -1 )); length =strlen (string); - result =UDS_ALLOCATE (length +1 , char,"split string" , &substrings[current_substring]); + result =uds_allocate (length +1 , char,"split string" , &substrings[current_substring]);if (result !=UDS_SUCCESS ) {free_string_array (substrings);return result;
@@ -339,7 +339,7 @@ join_strings(char **substring_array, size_t array_length, char separator, char *for (i =0 ; (i < array_length) && (substring_array[i] !=NULL ); i++) string_length +=strlen (substring_array[i]) +1 ; - result =UDS_ALLOCATE (string_length, char, __func__, &output); + result =uds_allocate (string_length, char, __func__, &output);if (result !=VDO_SUCCESS )return result;
@@ -733,7 +733,7 @@ static int parse_device_config(int argc,return VDO_BAD_CONFIGURATION ; } - result = UDS_ALLOCATE(1, struct device_config, "device_config", &config); + result = uds_allocate(1, struct device_config, "device_config", &config);if (result !=VDO_SUCCESS ) {handle_parse_error (config, error_ptr,"Could not allocate config structure" );return VDO_BAD_CONFIGURATION ;
drivers/md/dm-vdo/action-manager.c +1 -1
@@ -110,7 +110,7 @@ int vdo_make_action_manager(zone_count_t zones, struct action_manager **manager_ptr) {struct action_manager *manager; - int result = UDS_ALLOCATE(1, struct action_manager, __func__, &manager); + int result = uds_allocate(1, struct action_manager, __func__, &manager);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/block-map.c +5 -5
@@ -225,7 +225,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 = UDS_ALLOCATE(cache->page_count, struct page_info, "page infos", &cache->infos); + result = uds_allocate(cache->page_count, struct page_info, "page infos", &cache->infos);if (result !=UDS_SUCCESS )return result;
@@ -2363,19 +2363,19 @@ static int make_segment(struct forest *old_forest, forest->segments = index +1 ; - result = UDS_ALLOCATE(forest->segments, struct boundary, + result = uds_allocate(forest->segments, struct boundary,"forest boundary array" , &forest->boundaries);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (forest->segments, + result =uds_allocate (forest->segments, struct tree_page *,"forest page pointers" , &forest->pages);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (new_pages, + result =uds_allocate (new_pages, struct tree_page,"new forest pages" , &forest->pages[index]);
@@ -2403,7 +2403,7 @@ static int make_segment(struct forest *old_forest,struct block_map_tree *tree = &(forest->trees[root]);height_t height; -int result =UDS_ALLOCATE (forest->segments, +int result =uds_allocate (forest->segments, struct block_map_tree_segment,"tree root segments" , &tree->segments);
drivers/md/dm-vdo/chapter-index.c +1 -1
@@ -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 = UDS_ALLOCATE(1, struct open_chapter_index, "open chapter index", &index); + result = uds_allocate(1, struct open_chapter_index, "open chapter index", &index);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/config.c +1 -1
@@ -334,7 +334,7 @@ int uds_make_configuration(const struct uds_parameters *params, struct configuraif (result !=UDS_SUCCESS )return result; - result = UDS_ALLOCATE(1, struct configuration, __func__, &config); + result = uds_allocate(1, struct configuration, __func__, &config);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/dedupe.c +1 -1
@@ -2407,7 +2407,7 @@ initialize_zone(struct vdo *vdo, struct hash_zones *zones, zone_count_t zone_num timeout_index_operations_callback, zone->thread_id);INIT_LIST_HEAD (&zone->lock_pool); - result =UDS_ALLOCATE (LOCK_POOL_CAPACITY , + result =uds_allocate (LOCK_POOL_CAPACITY , struct hash_lock,"hash_lock array" , &zone->lock_array);
drivers/md/dm-vdo/delta-index.c +5 -5
@@ -329,16 +329,16 @@ static int initialize_delta_zone(struct delta_zone *delta_zone, {int result; - result =UDS_ALLOCATE (size, u8,"delta list" , &delta_zone->memory); + result =uds_allocate (size, u8,"delta list" , &delta_zone->memory);if (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (list_count +2 , u64,"delta list temp" , &delta_zone->new_offsets); + result =uds_allocate (list_count +2 , u64,"delta list temp" , &delta_zone->new_offsets);if (result !=UDS_SUCCESS )return result;/* Allocate the delta lists. */ - result =UDS_ALLOCATE (list_count +2 , + result =uds_allocate (list_count +2 , struct delta_list,"delta lists" , &delta_zone->delta_lists);
@@ -377,7 +377,7 @@ int uds_initialize_delta_index(struct delta_index *delta_index,unsigned int z;size_t zone_memory; - result =UDS_ALLOCATE (zone_count, + result =uds_allocate (zone_count, struct delta_zone,"Delta Index Zones" , &delta_index->delta_zones);
@@ -1084,7 +1084,7 @@ int uds_finish_restoring_delta_index(struct delta_index *delta_index,unsigned int z;u8 *data; - result =UDS_ALLOCATE (DELTA_LIST_MAX_BYTE_COUNT , u8, __func__, &data); + result =uds_allocate (DELTA_LIST_MAX_BYTE_COUNT , u8, __func__, &data);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/encodings.c +1 -1
@@ -800,7 +800,7 @@ static int allocate_partition(struct layout *layout,struct partition *partition;int result; - result = UDS_ALLOCATE(1, struct partition, __func__, &partition); + result = uds_allocate(1, struct partition, __func__, &partition);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/flush.c +2 -2
@@ -106,7 +106,7 @@ static void *allocate_flush(gfp_t gfp_mask, void *pool_data)if ((gfp_mask &GFP_NOWAIT ) ==GFP_NOWAIT ) { flush =uds_allocate_memory_nowait (sizeof (struct vdo_flush ), __func__); }else { - int result = UDS_ALLOCATE(1, struct vdo_flush, __func__, &flush); + int result = uds_allocate(1, struct vdo_flush, __func__, &flush);if (result !=VDO_SUCCESS )uds_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 = UDS_ALLOCATE(1, struct flusher, __func__, &vdo->flusher); + int result = uds_allocate(1, struct flusher, __func__, &vdo->flusher);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/funnel-queue.c +1 -1
@@ -15,7 +15,7 @@ int uds_make_funnel_queue(struct funnel_queue **queue_ptr)int result;struct funnel_queue *queue; - result = UDS_ALLOCATE(1, struct funnel_queue, "funnel queue", &queue); + result = uds_allocate(1, struct funnel_queue, "funnel queue", &queue);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/funnel-requestqueue.c +1 -1
@@ -201,7 +201,7 @@ int uds_make_request_queue(const char *queue_name,int result;struct uds_request_queue *queue; - result = UDS_ALLOCATE(1, struct uds_request_queue, __func__, &queue); + result = uds_allocate(1, struct uds_request_queue, __func__, &queue);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/funnel-workqueue.c +3 -3
@@ -328,7 +328,7 @@ static int make_simple_work_queue(const char *thread_name_prefix, type->max_priority, VDO_WORK_Q_MAX_PRIORITY); - result = UDS_ALLOCATE(1, struct simple_work_queue, "simple work queue", &queue); + result = uds_allocate(1, struct simple_work_queue, "simple work queue", &queue);if (result !=UDS_SUCCESS )return result;
@@ -414,11 +414,11 @@ int vdo_make_work_queue(const char *thread_name_prefix,return result; } - result = UDS_ALLOCATE(1, struct round_robin_work_queue, "round-robin work queue", &queue); + result = uds_allocate(1, struct round_robin_work_queue, "round-robin work queue", &queue);if (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (thread_count, + result =uds_allocate (thread_count, struct simple_work_queue *,"subordinate work queues" , &queue->service_queues);
drivers/md/dm-vdo/geometry.c +1 -1
@@ -63,7 +63,7 @@ int uds_make_geometry(size_t bytes_per_page,int result;struct geometry *geometry; - result = UDS_ALLOCATE(1, struct geometry, "geometry", &geometry); + result = uds_allocate(1, struct geometry, "geometry", &geometry);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/index-layout.c +6 -6
@@ -554,7 +554,7 @@ static int __must_check write_index_save_header(struct index_save_layout *isl,u8 *buffer;size_t offset =0 ; - result =UDS_ALLOCATE (table->encoded_size, u8,"index save data" , &buffer); + result =uds_allocate (table->encoded_size, u8,"index save data" , &buffer);if (result !=UDS_SUCCESS )return result;
@@ -723,7 +723,7 @@ static int __must_check write_layout_header(struct index_layout *layout,u8 *buffer;size_t offset =0 ; - result =UDS_ALLOCATE (table->encoded_size, u8,"layout data" , &buffer); + result =uds_allocate (table->encoded_size, u8,"layout data" , &buffer);if (result !=UDS_SUCCESS )return result;
@@ -813,7 +813,7 @@ static int create_index_layout(struct index_layout *layout, struct configurationif (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (sizes.save_count, + result =uds_allocate (sizes.save_count, struct index_save_layout, __func__, &layout->index.saves);
@@ -1217,7 +1217,7 @@ static int __must_check read_super_block_data(struct buffered_reader *reader,u8 *buffer;size_t offset =0 ; - result =UDS_ALLOCATE (saved_size, u8,"super block data" , &buffer); + result =uds_allocate (saved_size, u8,"super block data" , &buffer);if (result !=UDS_SUCCESS )return result;
@@ -1344,7 +1344,7 @@ reconstitute_layout(struct index_layout *layout, struct region_table *table, u64int result;u64 next_block = first_block; - result =UDS_ALLOCATE (layout->super.max_saves, + result =uds_allocate (layout->super.max_saves, struct index_save_layout, __func__, &layout->index.saves);
@@ -1708,7 +1708,7 @@ int uds_make_index_layout(struct configuration *config,if (result !=UDS_SUCCESS )return result; - result = UDS_ALLOCATE(1, struct index_layout, __func__, &layout); + result = uds_allocate(1, struct index_layout, __func__, &layout);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/index-page-map.c +4 -4
@@ -38,13 +38,13 @@ int uds_make_index_page_map(const struct geometry *geometry, struct index_page_mint result;struct index_page_map *map; - result = UDS_ALLOCATE(1, struct index_page_map, "page map", &map); + result = uds_allocate(1, struct index_page_map, "page map", &map);if (result !=UDS_SUCCESS )return result; map->geometry = geometry; map->entries_per_chapter = geometry->index_pages_per_chapter -1 ; - result =UDS_ALLOCATE (get_entry_count (geometry), + result =uds_allocate (get_entry_count (geometry), u16,"Index Page Map Entries" , &map->entries);
@@ -126,7 +126,7 @@ int uds_write_index_page_map(struct index_page_map *map, struct buffered_writeru64 saved_size =uds_compute_index_page_map_save_size (map->geometry);u32 i; - result =UDS_ALLOCATE (saved_size, u8,"page map data" , &buffer); + result =uds_allocate (saved_size, u8,"page map data" , &buffer);if (result !=UDS_SUCCESS )return result;
@@ -153,7 +153,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 =UDS_ALLOCATE (saved_size, u8,"page map data" , &buffer); + result =uds_allocate (saved_size, u8,"page map data" , &buffer);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/index-session.c +1 -1
@@ -218,7 +218,7 @@ static int __must_check make_empty_index_session(struct uds_index_session **indeint result;struct uds_index_session *session; - result = UDS_ALLOCATE(1, struct uds_index_session, __func__, &session); + result = uds_allocate(1, struct uds_index_session, __func__, &session);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/index.c +3 -3
@@ -88,7 +88,7 @@ launch_zone_message(struct uds_zone_message message, unsigned int zone, struct uint result;struct uds_request *request; - result = UDS_ALLOCATE(1, struct uds_request, __func__, &request); + result = uds_allocate(1, struct uds_request, __func__, &request);if (result !=UDS_SUCCESS )return result;
@@ -1137,7 +1137,7 @@ static int make_index_zone(struct uds_index *index, unsigned int zone_number)int result;struct index_zone *zone; - result = UDS_ALLOCATE(1, struct index_zone, "index zone", &zone); + result = uds_allocate(1, struct index_zone, "index zone", &zone);if (result !=UDS_SUCCESS )return result;
@@ -1194,7 +1194,7 @@ int uds_make_index(struct configuration *config,return result; } - result = UDS_ALLOCATE(index->zone_count, struct index_zone *, "zones", &index->zones); + result = uds_allocate(index->zone_count, struct index_zone *, "zones", &index->zones);if (result !=UDS_SUCCESS ) {uds_free_index (index);return result;
drivers/md/dm-vdo/int-map.c +2 -2
@@ -166,7 +166,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 UDS_ALLOCATE(map->bucket_count, struct bucket, + return uds_allocate(map->bucket_count, struct bucket,"struct int_map buckets" , &map->buckets); }
@@ -192,7 +192,7 @@ int vdo_make_int_map(size_t initial_capacity, unsigned int initial_load, structif (initial_load >100 )return UDS_INVALID_ARGUMENT ; - result = UDS_ALLOCATE(1, struct int_map, "struct int_map", &map); + result = uds_allocate(1, struct int_map, "struct int_map", &map);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/io-factory.c +3 -3
@@ -64,7 +64,7 @@ int uds_make_io_factory(struct block_device *bdev, struct io_factory **factory_pint result;struct io_factory *factory; - result = UDS_ALLOCATE(1, struct io_factory, __func__, &factory); + result = uds_allocate(1, struct io_factory, __func__, &factory);if (result !=UDS_SUCCESS )return result;
@@ -154,7 +154,7 @@ int uds_make_buffered_reader(struct io_factory *factory,if (result !=UDS_SUCCESS )return result; - result = UDS_ALLOCATE(1, struct buffered_reader, "buffered reader", &reader); + result = uds_allocate(1, struct buffered_reader, "buffered reader", &reader);if (result !=UDS_SUCCESS ) {dm_bufio_client_destroy (client);return result;
@@ -291,7 +291,7 @@ int uds_make_buffered_writer(struct io_factory *factory,if (result !=UDS_SUCCESS )return result; - result = UDS_ALLOCATE(1, struct buffered_writer, "buffered writer", &writer); + result = uds_allocate(1, struct buffered_writer, "buffered writer", &writer);if (result !=UDS_SUCCESS ) {dm_bufio_client_destroy (client);return result;
drivers/md/dm-vdo/memory-alloc.c +3 -3
@@ -246,7 +246,7 @@ int uds_allocate_memory(size_t size, size_t align, const char *what, void *ptr) }else {struct vmalloc_block_info *block; - if (UDS_ALLOCATE(1, struct vmalloc_block_info, __func__, &block) == + if (uds_allocate(1, struct vmalloc_block_info, __func__, &block) ==UDS_SUCCESS ) {/* * It is possible for __vmalloc to fail to allocate memory because there
@@ -354,7 +354,7 @@ int uds_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *wreturn UDS_SUCCESS ; } - result =UDS_ALLOCATE (size, char, what, new_ptr); + result =uds_allocate (size, char, what, new_ptr);if (result !=UDS_SUCCESS )return result;
@@ -374,7 +374,7 @@ int uds_duplicate_string(const char *string, const char *what, char **new_stringint result;u8 *dup; - result =UDS_ALLOCATE (strlen (string) +1 , u8, what, &dup); + result =uds_allocate (strlen (string) +1 , u8, what, &dup);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/memory-alloc.h +2 -2
@@ -18,7 +18,7 @@ int __must_check uds_allocate_memory(size_t size, size_t align, const char *whatvoid uds_free_memory (void *ptr); -/* Free memory allocated with UDS_ALLOCATE(). */ +/* Free memory allocated with uds_allocate(). */ #define uds_free (PTR ) uds_free_memory(PTR)static inline void *__uds_forget (void **ptr_ptr)
@@ -96,7 +96,7 @@ int __must_check uds_reallocate_memory(void *ptr,* * Return: UDS_SUCCESS or an error code */ -#define UDS_ALLOCATE (COUNT ,TYPE ,WHAT ,PTR ) \ +#define uds_allocate (COUNT ,TYPE ,WHAT ,PTR ) \ uds_do_allocation(COUNT, sizeof(TYPE), 0, __alignof__(TYPE), WHAT, PTR)/*
drivers/md/dm-vdo/message-stats.c +1 -1
@@ -1204,7 +1204,7 @@ int vdo_write_stats(struct vdo *vdo,struct vdo_statistics *stats;int result; - result = UDS_ALLOCATE(1, struct vdo_statistics, __func__, &stats); + result = uds_allocate(1, struct vdo_statistics, __func__, &stats);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/packer.c +1 -1
@@ -152,7 +152,7 @@ int vdo_make_packer(struct vdo *vdo, block_count_t bin_count, struct packer **pablock_count_t i;int result; - result = UDS_ALLOCATE(1, struct packer, __func__, &packer); + result = uds_allocate(1, struct packer, __func__, &packer);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/pointer-map.c +2 -2
@@ -125,7 +125,7 @@ static int allocate_buckets(struct pointer_map *map, size_t capacity)* without have to wrap back around to element zero. */ map->bucket_count = capacity + (NEIGHBORHOOD -1 ); -return UDS_ALLOCATE (map->bucket_count, +return uds_allocate (map->bucket_count, struct bucket,"pointer_map buckets" , &map->buckets);
@@ -159,7 +159,7 @@ int vdo_make_pointer_map(size_t initial_capacity,if (initial_load >100 )return UDS_INVALID_ARGUMENT ; - result = UDS_ALLOCATE(1, struct pointer_map, "pointer_map", &map); + result = uds_allocate(1, struct pointer_map, "pointer_map", &map);if (result !=UDS_SUCCESS )return result;
drivers/md/dm-vdo/recovery-journal.c +7 -7
@@ -592,36 +592,36 @@ static int __must_check initialize_lock_counter(struct recovery_journal *journalstruct thread_config *config = &vdo->thread_config;struct lock_counter *counter = &journal->lock_counter; - result =UDS_ALLOCATE (journal->size, u16, __func__, &counter->journal_counters); + result =uds_allocate (journal->size, u16, __func__, &counter->journal_counters);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (journal->size, + result =uds_allocate (journal->size, atomic_t, __func__, &counter->journal_decrement_counts);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (journal->size * config->logical_zone_count, + result =uds_allocate (journal->size * config->logical_zone_count, u16, __func__, &counter->logical_counters);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (journal->size, atomic_t, __func__, &counter->logical_zone_counts); + result =uds_allocate (journal->size, atomic_t, __func__, &counter->logical_zone_counts);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (journal->size * config->physical_zone_count, + result =uds_allocate (journal->size * config->physical_zone_count, u16, __func__, &counter->physical_counters);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (journal->size, atomic_t, __func__, &counter->physical_zone_counts); + result =uds_allocate (journal->size, atomic_t, __func__, &counter->physical_zone_counts);if (result !=VDO_SUCCESS )return result;
@@ -677,7 +677,7 @@ static int initialize_recovery_block(struct vdo *vdo,* 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 =UDS_ALLOCATE (VDO_BLOCK_SIZE , char, __func__, &data); + result =uds_allocate (VDO_BLOCK_SIZE , char, __func__, &data);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/repair.c +4 -4
@@ -1432,7 +1432,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 = UDS_ALLOCATE(count, struct numbered_block_mapping, __func__, &repair->entries); + result = uds_allocate(count, struct numbered_block_mapping, __func__, &repair->entries);if (result !=VDO_SUCCESS )return result;
@@ -1477,7 +1477,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 =UDS_ALLOCATE (repair->entry_count, + result =uds_allocate (repair->entry_count, struct numbered_block_mapping, __func__, &repair->entries);
@@ -1738,11 +1738,11 @@ void vdo_repair(struct vdo_completion *parent)prepare_repair_completion (repair, finish_repair,VDO_ZONE_TYPE_ADMIN ); repair->page_count = page_count; - result =UDS_ALLOCATE (remaining *VDO_BLOCK_SIZE , char, __func__, &repair->journal_data); + result =uds_allocate (remaining *VDO_BLOCK_SIZE , char, __func__, &repair->journal_data);if (abort_on_error (result, repair))return ; - result = UDS_ALLOCATE(vio_count, struct vio, __func__, &repair->vios); + result = uds_allocate(vio_count, struct vio, __func__, &repair->vios);if (abort_on_error (result, repair))return ;
drivers/md/dm-vdo/slab-depot.c +11 -11
@@ -2425,7 +2425,7 @@ static int allocate_slab_counters(struct vdo_slab *slab)if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (slab->reference_block_count, + result =uds_allocate (slab->reference_block_count, struct reference_block, __func__, &slab->reference_blocks);
@@ -2437,7 +2437,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 =UDS_ALLOCATE (bytes, vdo_refcount_t,"ref counts array" , &slab->counters); + result =uds_allocate (bytes, vdo_refcount_t,"ref counts array" , &slab->counters);if (result !=UDS_SUCCESS ) {uds_free (uds_forget (slab->reference_blocks));return result;
@@ -3549,7 +3549,7 @@ get_slab_statuses(struct block_allocator *allocator, struct slab_status **statusstruct slab_status *statuses;struct slab_iterator iterator =get_slab_iterator (allocator); - result = UDS_ALLOCATE(allocator->slab_count, struct slab_status, __func__, &statuses); + result = uds_allocate(allocator->slab_count, struct slab_status, __func__, &statuses);if (result !=VDO_SUCCESS )return result;
@@ -3726,14 +3726,14 @@ static int initialize_slab_journal(struct vdo_slab *slab)const struct slab_config *slab_config = &slab->allocator->depot->slab_config;int result; - result =UDS_ALLOCATE (slab_config->slab_journal_blocks, + result =uds_allocate (slab_config->slab_journal_blocks, struct journal_lock, __func__, &journal->locks);if (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (VDO_BLOCK_SIZE , + result =uds_allocate (VDO_BLOCK_SIZE , char,"struct packed_slab_journal_block" , (char **) &journal->block);
@@ -3793,7 +3793,7 @@ make_slab(physical_block_number_t slab_origin,struct vdo_slab *slab;int result; - result = UDS_ALLOCATE(1, struct vdo_slab, __func__, &slab); + result = uds_allocate(1, struct vdo_slab, __func__, &slab);if (result !=VDO_SUCCESS )return result;
@@ -3849,7 +3849,7 @@ static int allocate_slabs(struct slab_depot *depot, slab_count_t slab_count)physical_block_number_t slab_origin;int result; - result =UDS_ALLOCATE (slab_count, + result =uds_allocate (slab_count, struct vdo_slab *,"slab pointer array" , &depot->new_slabs);
@@ -4010,7 +4010,7 @@ static int initialize_slab_scrubber(struct block_allocator *allocator)char *journal_data;int result; - result =UDS_ALLOCATE (VDO_BLOCK_SIZE * slab_journal_size, char, __func__, &journal_data); + result =uds_allocate (VDO_BLOCK_SIZE * slab_journal_size, char, __func__, &journal_data);if (result !=VDO_SUCCESS )return result;
@@ -4045,7 +4045,7 @@ initialize_slab_summary_block(struct block_allocator *allocator, block_count_t istruct slab_summary_block *block = &allocator->summary_blocks[index];int result; - result =UDS_ALLOCATE (VDO_BLOCK_SIZE , char, __func__, &block->outgoing_entries); + result =uds_allocate (VDO_BLOCK_SIZE , char, __func__, &block->outgoing_entries);if (result !=VDO_SUCCESS )return result;
@@ -4109,7 +4109,7 @@ static int __must_check initialize_block_allocator(struct slab_depot *depot, zonif (result !=VDO_SUCCESS )return result; - result =UDS_ALLOCATE (VDO_SLAB_SUMMARY_BLOCKS_PER_ZONE , + result =uds_allocate (VDO_SLAB_SUMMARY_BLOCKS_PER_ZONE , struct slab_summary_block, __func__, &allocator->summary_blocks);
@@ -4172,7 +4172,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 =UDS_ALLOCATE (MAXIMUM_VDO_SLAB_SUMMARY_ENTRIES , + result =uds_allocate (MAXIMUM_VDO_SLAB_SUMMARY_ENTRIES , struct slab_summary_entry, __func__, &depot->summary_entries);
drivers/md/dm-vdo/slab-depot.h +1 -1
@@ -235,7 +235,7 @@ struct vdo_slab {/* The number of free blocks */ u32 free_blocks;/* The array of reference counts */ -vdo_refcount_t *counters;/* use UDS_ALLOCATE to align data ptr */ +vdo_refcount_t *counters;/* use uds_allocate() to align data ptr */ /* The saved block pointer and array indexes for the free block search */ struct search_cursor search_cursor;
drivers/md/dm-vdo/sparse-cache.c +3 -3
@@ -165,14 +165,14 @@ initialize_cached_chapter_index(struct cached_chapter_index *chapter, chapter->virtual_chapter =NO_CHAPTER ; chapter->index_pages_count = geometry->index_pages_per_chapter; - result =UDS_ALLOCATE (chapter->index_pages_count, + result =uds_allocate (chapter->index_pages_count, struct delta_index_page, __func__, &chapter->index_pages);if (result !=UDS_SUCCESS )return result; -return UDS_ALLOCATE (chapter->index_pages_count, +return uds_allocate (chapter->index_pages_count, struct dm_buffer *,"sparse index volume pages" , &chapter->page_buffers);
@@ -255,7 +255,7 @@ int uds_make_sparse_cache(const struct geometry *geometry, }/* purge_search_list() needs some temporary lists for sorting. */ - result =UDS_ALLOCATE (capacity *2 , + result =uds_allocate (capacity *2 , struct cached_chapter_index *,"scratch entries" , &cache->scratch_entries);
drivers/md/dm-vdo/uds-sysfs.c +1 -1
@@ -34,7 +34,7 @@ static char *buffer_to_string(const char *buf, size_t length) {char *string; -if (UDS_ALLOCATE (length +1 , char, __func__, &string) !=UDS_SUCCESS ) +if (uds_allocate (length +1 , char, __func__, &string) !=UDS_SUCCESS )return NULL ;memcpy (string, buf, length);
drivers/md/dm-vdo/uds-threads.c +1 -1
@@ -85,7 +85,7 @@ int uds_create_thread(void (*thread_function)(void *),struct thread *thread;int result; - result = UDS_ALLOCATE(1, struct thread, __func__, &thread); + result = uds_allocate(1, struct thread, __func__, &thread);if (result !=UDS_SUCCESS ) {uds_log_warning ("Error allocating memory for %s" , name);return result;
drivers/md/dm-vdo/vdo.c +11 -11
@@ -215,7 +215,7 @@ initialize_thread_config(struct thread_count_config counts, struct thread_config config->hash_zone_count = counts.hash_zones; } - result =UDS_ALLOCATE (config->logical_zone_count, + result =uds_allocate (config->logical_zone_count, thread_id_t,"logical thread array" , &config->logical_threads);
@@ -224,7 +224,7 @@ initialize_thread_config(struct thread_count_config counts, struct thread_configreturn result; } - result =UDS_ALLOCATE (config->physical_zone_count, + result =uds_allocate (config->physical_zone_count, thread_id_t,"physical thread array" , &config->physical_threads);
@@ -233,7 +233,7 @@ initialize_thread_config(struct thread_count_config counts, struct thread_configreturn result; } - result =UDS_ALLOCATE (config->hash_zone_count, + result =uds_allocate (config->hash_zone_count, thread_id_t,"hash thread array" , &config->hash_zone_threads);
@@ -242,7 +242,7 @@ initialize_thread_config(struct thread_count_config counts, struct thread_configreturn result; } - result =UDS_ALLOCATE (config->bio_thread_count, + result =uds_allocate (config->bio_thread_count, thread_id_t,"bio thread array" , &config->bio_threads);
@@ -285,7 +285,7 @@ static int __must_check read_geometry_block(struct vdo *vdo)char *block;int result; - result =UDS_ALLOCATE (VDO_BLOCK_SIZE , u8, __func__, &block); + result =uds_allocate (VDO_BLOCK_SIZE , u8, __func__, &block);if (result !=VDO_SUCCESS )return result;
@@ -531,7 +531,7 @@ initialize_vdo(struct vdo *vdo, struct device_config *config, unsigned int insta vdo->thread_config.thread_count);/* Compression context storage */ - result =UDS_ALLOCATE (config->thread_counts.cpu_threads, + result =uds_allocate (config->thread_counts.cpu_threads, char *,"LZ4 context" , &vdo->compression_context);
@@ -541,7 +541,7 @@ initialize_vdo(struct vdo *vdo, struct device_config *config, unsigned int insta }for (i =0 ; i < config->thread_counts.cpu_threads; i++) { - result =UDS_ALLOCATE (LZ4_MEM_COMPRESS , + result =uds_allocate (LZ4_MEM_COMPRESS , char,"LZ4 context" , &vdo->compression_context[i]);
@@ -581,7 +581,7 @@ int vdo_make(unsigned int instance,/* VDO-3769 - Set a generic reason so we don't ever return garbage. */ *reason ="Unspecified error" ; - result = UDS_ALLOCATE(1, struct vdo, __func__, &vdo); + result = uds_allocate(1, struct vdo, __func__, &vdo);if (result !=UDS_SUCCESS ) { *reason ="Cannot allocate VDO" ;return result;
@@ -602,7 +602,7 @@ int vdo_make(unsigned int instance,MODULE_NAME , instance);BUG_ON (vdo->thread_name_prefix[0 ] =='\0' ); - result =UDS_ALLOCATE (vdo->thread_config.thread_count, + result =uds_allocate (vdo->thread_config.thread_count, struct vdo_thread, __func__, &vdo->threads);
@@ -798,7 +798,7 @@ static int initialize_super_block(struct vdo *vdo, struct vdo_super_block *super {int result; - result =UDS_ALLOCATE (VDO_BLOCK_SIZE , + result =uds_allocate (VDO_BLOCK_SIZE , char,"encoded super block" , (char **) &vdo->super_block.buffer);
@@ -1111,7 +1111,7 @@ int vdo_register_read_only_listener(struct vdo *vdo,if (result !=VDO_SUCCESS )return result; - result = UDS_ALLOCATE(1, struct read_only_listener, __func__, &read_only_listener); + result = uds_allocate(1, struct read_only_listener, __func__, &read_only_listener);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/vio.c +2 -2
@@ -138,7 +138,7 @@ int create_multi_block_metadata_vio(struct vdo *vdo,* Metadata vios should use direct allocation and not use the buffer pool, which is * reserved for submissions from the linux block layer. */ - result = UDS_ALLOCATE(1, struct vio, __func__, &vio); + result = uds_allocate(1, struct vio, __func__, &vio);if (result !=VDO_SUCCESS ) {uds_log_error ("metadata vio allocation failure %d" , result);return result;
@@ -346,7 +346,7 @@ int make_vio_pool(struct vdo *vdo,INIT_LIST_HEAD (&pool->available);INIT_LIST_HEAD (&pool->busy); - result =UDS_ALLOCATE (pool_size *VDO_BLOCK_SIZE , char,"VIO pool buffer" , &pool->buffer); + result =uds_allocate (pool_size *VDO_BLOCK_SIZE , char,"VIO pool buffer" , &pool->buffer);if (result !=VDO_SUCCESS ) {free_vio_pool (pool);return result;
drivers/md/dm-vdo/volume-index.c +4 -4
@@ -1189,14 +1189,14 @@ static int initialize_volume_sub_index(const struct configuration *config, (zone_count * sizeof(struct volume_sub_index_zone)));/* The following arrays are initialized to all zeros. */ - result =UDS_ALLOCATE (params.list_count, + result =uds_allocate (params.list_count, u64,"first chapter to flush" , &sub_index->flush_chapters);if (result !=UDS_SUCCESS )return result; -return UDS_ALLOCATE (zone_count, +return uds_allocate (zone_count, struct volume_sub_index_zone,"volume index zones" , &sub_index->zones);
@@ -1211,7 +1211,7 @@ int uds_make_volume_index(const struct configuration *config,struct volume_index *volume_index;int result; - result = UDS_ALLOCATE(1, struct volume_index, "volume index", &volume_index); + result = uds_allocate(1, struct volume_index, "volume index", &volume_index);if (result !=UDS_SUCCESS )return result;
@@ -1234,7 +1234,7 @@ int uds_make_volume_index(const struct configuration *config, volume_index->sparse_sample_rate = config->sparse_sample_rate; - result =UDS_ALLOCATE (config->zone_count, + result =uds_allocate (config->zone_count, struct volume_index_zone,"volume index zones" , &volume_index->zones);
drivers/md/dm-vdo/volume.c +7 -7
@@ -1576,25 +1576,25 @@ initialize_page_cache(struct page_cache *cache,if (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (VOLUME_CACHE_MAX_QUEUED_READS , + result =uds_allocate (VOLUME_CACHE_MAX_QUEUED_READS , struct queued_read,"volume read queue" , &cache->read_queue);if (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (cache->zone_count, + result =uds_allocate (cache->zone_count, struct search_pending_counter,"Volume Cache Zones" , &cache->search_pending_counters);if (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (cache->indexable_pages, u16,"page cache index" , &cache->index); + result =uds_allocate (cache->indexable_pages, u16,"page cache index" , &cache->index);if (result !=UDS_SUCCESS )return result; - result =UDS_ALLOCATE (cache->cache_slots, + result =uds_allocate (cache->cache_slots, struct cached_page,"page cache cache" , &cache->cache);
@@ -1621,7 +1621,7 @@ int uds_make_volume(const struct configuration *config,unsigned int reserved_buffers;int result; - result = UDS_ALLOCATE(1, struct volume, "volume", &volume); + result = uds_allocate(1, struct volume, "volume", &volume);if (result !=UDS_SUCCESS )return result;
@@ -1658,7 +1658,7 @@ int uds_make_volume(const struct configuration *config,return result; } - result =UDS_ALLOCATE (geometry->records_per_page, + result =uds_allocate (geometry->records_per_page, const struct uds_volume_record *,"record pointers" , &volume->record_pointers);
@@ -1717,7 +1717,7 @@ int uds_make_volume(const struct configuration *config,return result; } - result =UDS_ALLOCATE (config->read_threads, + result =uds_allocate (config->read_threads, struct thread *,"reader threads" , &volume->reader_threads);
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 5/8 dm vdo memory-alloc: rename UDS_ALLOCATE_EXTENDED to uds_allocate_extended
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo/block-map.c | 8 ++++---- drivers/md/dm-vdo/data-vio.c | 2 +- drivers/md/dm-vdo/dedupe.c | 2 +- drivers/md/dm-vdo/index-layout.c | 6 +++--- drivers/md/dm-vdo/index.c | 4 ++-- drivers/md/dm-vdo/io-submitter.c | 2 +- drivers/md/dm-vdo/logical-zone.c | 2 +- drivers/md/dm-vdo/memory-alloc.h | 2 +- drivers/md/dm-vdo/open-chapter.c | 2 +- drivers/md/dm-vdo/packer.c | 4 ++-- drivers/md/dm-vdo/physical-zone.c | 4 ++-- drivers/md/dm-vdo/priority-table.c | 2 +- drivers/md/dm-vdo/radix-sort.c | 2 +- drivers/md/dm-vdo/recovery-journal.c | 2 +- drivers/md/dm-vdo/repair.c | 2 +- drivers/md/dm-vdo/slab-depot.c | 2 +- drivers/md/dm-vdo/vio.c | 4 ++-- 17 files changed, 26 insertions(+), 26 deletions(-)
drivers/md/dm-vdo/block-map.c +4 -4
@@ -2482,7 +2482,7 @@ static int make_forest(struct block_map *map, block_count_t entries)return VDO_SUCCESS ; } - result = UDS_ALLOCATE_EXTENDED(struct forest, map->root_count, + result = uds_allocate_extended(struct forest, map->root_count, struct block_map_tree, __func__, &forest);if (result !=VDO_SUCCESS )
@@ -2709,7 +2709,7 @@ void vdo_traverse_forest(struct block_map *map,struct cursors *cursors;int result; - result = UDS_ALLOCATE_EXTENDED(struct cursors, + result = uds_allocate_extended(struct cursors, map->root_count, struct cursor, __func__,
@@ -2760,7 +2760,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 = UDS_ALLOCATE_EXTENDED(struct dirty_lists, + result = uds_allocate_extended(struct dirty_lists, maximum_age, dirty_era_t, __func__,
@@ -2916,7 +2916,7 @@ int vdo_decode_block_map(struct block_map_state_2_0 state,if (result !=UDS_SUCCESS )return result; - result = UDS_ALLOCATE_EXTENDED(struct block_map, + result = uds_allocate_extended(struct block_map, vdo->thread_config.logical_zone_count, struct block_map_zone, __func__,
drivers/md/dm-vdo/data-vio.c +1 -1
@@ -844,7 +844,7 @@ int make_data_vio_pool(struct vdo *vdo,struct data_vio_pool *pool;data_vio_count_t i; - result = UDS_ALLOCATE_EXTENDED(struct data_vio_pool, + result = uds_allocate_extended(struct data_vio_pool, pool_size, struct data_vio, __func__,
drivers/md/dm-vdo/dedupe.c +1 -1
@@ -2463,7 +2463,7 @@ int vdo_make_hash_zones(struct vdo *vdo, struct hash_zones **zones_ptr)if (zone_count ==0 )return VDO_SUCCESS ; - result = UDS_ALLOCATE_EXTENDED(struct hash_zones, + result = uds_allocate_extended(struct hash_zones, zone_count, struct hash_zone, __func__,
drivers/md/dm-vdo/index-layout.c +3 -3
@@ -491,7 +491,7 @@ make_index_save_region_table(struct index_save_layout *isl, struct region_table type =RH_TYPE_UNSAVED ; } - result = UDS_ALLOCATE_EXTENDED(struct region_table, + result = uds_allocate_extended(struct region_table, region_count, struct layout_region, "layout region table for ISL",
@@ -674,7 +674,7 @@ make_layout_region_table(struct index_layout *layout, struct region_table **tablstruct region_table *table;struct layout_region *lr; - result = UDS_ALLOCATE_EXTENDED(struct region_table, + result = uds_allocate_extended(struct region_table, region_count, struct layout_region, "layout region table",
@@ -1175,7 +1175,7 @@ load_region_table(struct buffered_reader *reader, struct region_table **table_pt"unknown region table version %hu" , header.version); - result = UDS_ALLOCATE_EXTENDED(struct region_table, + result = uds_allocate_extended(struct region_table, header.region_count, struct layout_region, "single file layout region table",
drivers/md/dm-vdo/index.c +2 -2
@@ -767,7 +767,7 @@ static int make_chapter_writer(struct uds_index *index, struct chapter_writer **size_t collated_records_size = (sizeof (struct uds_volume_record ) * index->volume->geometry->records_per_chapter); - result = UDS_ALLOCATE_EXTENDED(struct chapter_writer, + result = uds_allocate_extended(struct chapter_writer, index->zone_count, struct open_chapter_zone *, "Chapter Writer",
@@ -1178,7 +1178,7 @@ int uds_make_index(struct configuration *config,u64 nonce;unsigned int z; - result = UDS_ALLOCATE_EXTENDED(struct uds_index, + result = uds_allocate_extended(struct uds_index, config->zone_count, struct uds_request_queue *, "index",
drivers/md/dm-vdo/io-submitter.c +1 -1
@@ -382,7 +382,7 @@ int vdo_make_io_submitter(unsigned int thread_count,struct io_submitter *io_submitter;int result; - result = UDS_ALLOCATE_EXTENDED(struct io_submitter, + result = uds_allocate_extended(struct io_submitter, thread_count, struct bio_queue_data, "bio submission data",
drivers/md/dm-vdo/logical-zone.c +1 -1
@@ -95,7 +95,7 @@ int vdo_make_logical_zones(struct vdo *vdo, struct logical_zones **zones_ptr)if (zone_count ==0 )return VDO_SUCCESS ; - result = UDS_ALLOCATE_EXTENDED(struct logical_zones, zone_count, + result = uds_allocate_extended(struct logical_zones, zone_count, struct logical_zone, __func__, &zones);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/memory-alloc.h +1 -1
@@ -112,7 +112,7 @@ int __must_check uds_reallocate_memory(void *ptr,* * Return: UDS_SUCCESS or an error code */ -#define UDS_ALLOCATE_EXTENDED (TYPE1 ,COUNT ,TYPE2 ,WHAT ,PTR ) \ +#define uds_allocate_extended (TYPE1 ,COUNT ,TYPE2 ,WHAT ,PTR ) \ __extension__({ \ int _result; \ TYPE1 **_ptr = (PTR); \
drivers/md/dm-vdo/open-chapter.c +1 -1
@@ -70,7 +70,7 @@ int uds_make_open_chapter(const struct geometry *geometry,size_t capacity = geometry->records_per_chapter / zone_count;size_t slot_count = (1 <<bits_per (capacity *LOAD_RATIO )); - result = UDS_ALLOCATE_EXTENDED(struct open_chapter_zone, + result = uds_allocate_extended(struct open_chapter_zone, slot_count, struct open_chapter_zone_slot, "open chapter",
drivers/md/dm-vdo/packer.c +2 -2
@@ -123,7 +123,7 @@ static int __must_check make_bin(struct packer *packer)struct packer_bin *bin;int result; - result = UDS_ALLOCATE_EXTENDED(struct packer_bin, + result = uds_allocate_extended(struct packer_bin, VDO_MAX_COMPRESSION_SLOTS, struct vio *, __func__,
@@ -174,7 +174,7 @@ int vdo_make_packer(struct vdo *vdo, block_count_t bin_count, struct packer **pa* bin must have a canceler for which it is waiting, and any canceler will only have * canceled one lock holder at a time. */ - result = UDS_ALLOCATE_EXTENDED(struct packer_bin, + result = uds_allocate_extended(struct packer_bin,MAXIMUM_VDO_USER_VIOS /2 , struct vio *, __func__, &packer->canceled_bin);
drivers/md/dm-vdo/physical-zone.c +2 -2
@@ -241,7 +241,7 @@ static int make_pbn_lock_pool(size_t capacity, struct pbn_lock_pool **pool_ptr)struct pbn_lock_pool *pool;int result; - result = UDS_ALLOCATE_EXTENDED(struct pbn_lock_pool, + result = uds_allocate_extended(struct pbn_lock_pool, capacity, idle_pbn_lock, __func__,
@@ -372,7 +372,7 @@ int vdo_make_physical_zones(struct vdo *vdo, struct physical_zones **zones_ptr)if (zone_count ==0 )return VDO_SUCCESS ; - result = UDS_ALLOCATE_EXTENDED(struct physical_zones, + result = uds_allocate_extended(struct physical_zones, zone_count, struct physical_zone, __func__,
drivers/md/dm-vdo/priority-table.c +1 -1
@@ -62,7 +62,7 @@ int vdo_make_priority_table(unsigned int max_priority, struct priority_table **tif (max_priority >MAX_PRIORITY )return UDS_INVALID_ARGUMENT ; - result = UDS_ALLOCATE_EXTENDED(struct priority_table, max_priority + 1, + result = uds_allocate_extended(struct priority_table, max_priority + 1, struct bucket, __func__, &table);if (result !=VDO_SUCCESS )return result;
drivers/md/dm-vdo/radix-sort.c +1 -1
@@ -220,7 +220,7 @@ int uds_make_radix_sorter(unsigned int count, struct radix_sorter **sorter)unsigned int stack_size = count /INSERTION_SORT_THRESHOLD ;struct radix_sorter *radix_sorter; - result = UDS_ALLOCATE_EXTENDED(struct radix_sorter, + result = uds_allocate_extended(struct radix_sorter, stack_size, struct task, __func__,
drivers/md/dm-vdo/recovery-journal.c +1 -1
@@ -724,7 +724,7 @@ int vdo_decode_recovery_journal(struct recovery_journal_state_7_0 state,struct recovery_journal *journal;int result; - result = UDS_ALLOCATE_EXTENDED(struct recovery_journal, + result = uds_allocate_extended(struct recovery_journal, RECOVERY_JOURNAL_RESERVED_BLOCKS, struct recovery_journal_block, __func__,
drivers/md/dm-vdo/repair.c +1 -1
@@ -1722,7 +1722,7 @@ void vdo_repair(struct vdo_completion *parent)uds_log_warning ("Device was dirty, rebuilding reference counts" ); } - result = UDS_ALLOCATE_EXTENDED(struct repair_completion, + result = uds_allocate_extended(struct repair_completion, page_count, struct vdo_page_completion, __func__,
drivers/md/dm-vdo/slab-depot.c +1 -1
@@ -4264,7 +4264,7 @@ int vdo_decode_slab_depot(struct slab_depot_state_2_0 state, "slab size must be a power of two"); slab_size_shift =ilog2 (slab_size); - result = UDS_ALLOCATE_EXTENDED(struct slab_depot, + result = uds_allocate_extended(struct slab_depot, vdo->thread_config.physical_zone_count, struct block_allocator, __func__,
drivers/md/dm-vdo/vio.c +2 -2
@@ -52,7 +52,7 @@ static int create_multi_block_bio(block_count_t size, struct bio **bio_ptr)struct bio *bio =NULL ;int result; - result = UDS_ALLOCATE_EXTENDED(struct bio, size + 1, struct bio_vec, "bio", &bio); + result = uds_allocate_extended(struct bio, size + 1, struct bio_vec, "bio", &bio);if (result !=VDO_SUCCESS )return result;
@@ -334,7 +334,7 @@ int make_vio_pool(struct vdo *vdo,char *ptr;int result; - result = UDS_ALLOCATE_EXTENDED(struct vio_pool, + result = uds_allocate_extended(struct vio_pool, pool_size, struct pooled_vio, __func__,
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 6/8 dm vdo memory-alloc: rename uds_free_memory to uds_free
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo/memory-alloc.c | 2 +- drivers/md/dm-vdo/memory-alloc.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/md/dm-vdo/memory-alloc.c +1 -1
@@ -319,7 +319,7 @@ void *uds_allocate_memory_nowait(size_t size, const char *what __maybe_unused)return p; } -void uds_free_memory (void *ptr) +void uds_free (void *ptr) {if (ptr !=NULL ) {if (is_vmalloc_addr (ptr)) {
drivers/md/dm-vdo/memory-alloc.h +1 -3
@@ -16,10 +16,8 @@int __must_check uds_allocate_memory (size_t size,size_t align,const char *what,void *ptr); -void uds_free_memory (void *ptr); -/* Free memory allocated with uds_allocate(). */ -#define uds_free (PTR ) uds_free_memory(PTR) +void uds_free (void *ptr);static inline void *__uds_forget (void **ptr_ptr) {
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 7/8 dm vdo memory-alloc: cleanup flow of memory-alloc.h
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo/memory-alloc.h | 51 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/md/dm-vdo/memory-alloc.h +25 -26
@@ -12,27 +12,9 @@#include "permassert.h" #include "thread-registry.h" -/* Custom memory allocation functions for UDS that track memory usage */ - +/* Custom memory allocation function for UDS that tracks memory usage */ int __must_check uds_allocate_memory (size_t size,size_t align,const char *what,void *ptr); -/* Free memory allocated with uds_allocate(). */ -void uds_free (void *ptr); - -static inline void *__uds_forget (void **ptr_ptr) -{ -void *ptr = *ptr_ptr; - - *ptr_ptr =NULL ; -return ptr; -} - -/* -* Null out a pointer and return a copy to it. This macro should be used when passing a pointer to -* a function for which it is not safe to access the pointer once the function returns. -*/ -#define uds_forget (ptr) __uds_forget((void **) &(ptr)) -/* * Allocate storage based on element counts, sizes, and alignment. *
@@ -77,12 +59,6 @@ static inline int uds_do_allocation(size_t count,return uds_allocate_memory (total_size, align, what, ptr); } -int __must_check uds_reallocate_memory (void *ptr, -size_t old_size, -size_t size, -const char *what, -void *new_ptr); -/* * Allocate one or more elements of the indicated type, logging an error if the allocation fails. * The memory will be zeroed.
@@ -150,12 +126,35 @@ static inline int __must_check uds_allocate_cache_aligned(size_t size, const cha*/ void *__must_check uds_allocate_memory_nowait (size_t size,const char *what); +int __must_check uds_reallocate_memory (void *ptr, +size_t old_size, +size_t size, +const char *what, +void *new_ptr); +int __must_check uds_duplicate_string (const char *string,const char *what,char **new_string); -void uds_memory_exit (void ); +/* Free memory allocated with uds_allocate(). */ +void uds_free (void *ptr); + +static inline void *__uds_forget (void **ptr_ptr) +{ +void *ptr = *ptr_ptr; + + *ptr_ptr =NULL ; +return ptr; +} + +/* +* Null out a pointer and return a copy to it. This macro should be used when passing a pointer to +* a function for which it is not safe to access the pointer once the function returns. +*/ +#define uds_forget (ptr) __uds_forget((void **) &(ptr))void uds_memory_init (void ); +void uds_memory_exit (void ); +void uds_register_allocating_thread (struct registered_thread *new_thread,const bool *flag_ptr);void uds_unregister_allocating_thread (void );
Signature · 1 line
2.40.0
Matthew Sakai
maintainerPATCH 8/8 dm vdo memory-alloc: mark branch unlikely() in uds_allocate_memory()
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
Remove temporary 'duration' variable. And cleanup coding style nit.
--- drivers/md/dm-vdo/memory-alloc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/md/dm-vdo/memory-alloc.c +2 -6
@@ -286,13 +286,9 @@ int uds_allocate_memory(size_t size, size_t align, const char *what, void *ptr)if (allocations_restricted)memalloc_noio_restore (noio_flags); -if (p ==NULL ) { -unsigned int duration =jiffies_to_msecs (jiffies - start_time); - +if (unlikely (p ==NULL )) {uds_log_error ("Could not allocate %zu bytes for %s in %u msecs" , - size, - what, - duration); + size, what,jiffies_to_msecs (jiffies - start_time));return -ENOMEM ; }
Signature · 1 line
2.40.0