dm vdo wait-queue: clean up interface
Subsystems (2)
Matthew Sakai
maintainercover dm vdo wait-queue: clean up interface
Add proper namespace to interface and clean up some functions.
Mike Snitzer (5):
dm vdo wait-queue: add proper namespace to interface dm vdo wait-queue: remove unused debug function
vdo_waitq_get_next_waiter
dm vdo wait-queue: optimize vdo_waitq_dequeue_matching_waiters dm vdo block-map: optimize enter_zone_read_only_mode dm vdo wait-queue: rename to vdo_waitq_dequeue_waiter
drivers/md/dm-vdo/block-map.c | 143 +++++++++---------- drivers/md/dm-vdo/block-map.h | 10 +- drivers/md/dm-vdo/data-vio.c | 14 +- drivers/md/dm-vdo/data-vio.h | 12 +- drivers/md/dm-vdo/dedupe.c | 50 +++---- drivers/md/dm-vdo/dump.c | 12 +- drivers/md/dm-vdo/flush.c | 32 +++-- drivers/md/dm-vdo/flush.h | 2 +- drivers/md/dm-vdo/physical-zone.c | 4 +- drivers/md/dm-vdo/recovery-journal.c | 69 ++++----- drivers/md/dm-vdo/recovery-journal.h | 10 +- drivers/md/dm-vdo/slab-depot.c | 99 ++++++------- drivers/md/dm-vdo/slab-depot.h | 22 +-- drivers/md/dm-vdo/vio.c | 12 +- drivers/md/dm-vdo/vio.h | 2 +- drivers/md/dm-vdo/wait-queue.c | 200 ++++++++++++--------------- drivers/md/dm-vdo/wait-queue.h | 129 +++++++++-------- 17 files changed, 409 insertions(+), 413 deletions(-)
Signature · 1 line
2.42.0
Matthew Sakai
maintainerPATCH 1/5 dm vdo wait-queue: add proper namespace to interface
From: Mike Snitzer <[email protected]>
Rename various interfaces and structs associated with vdo's wait-queue, e.g.: s/wait_queue/vdo_wait_queue/, s/waiter/vdo_waiter/, etc.
Now all function names start with "vdo_waitq_" or "vdo_waiter_".
--- drivers/md/dm-vdo/block-map.c | 134 ++++++++++--------- drivers/md/dm-vdo/block-map.h | 10 +- drivers/md/dm-vdo/data-vio.c | 14 +- drivers/md/dm-vdo/data-vio.h | 12 +- drivers/md/dm-vdo/dedupe.c | 48 +++---- drivers/md/dm-vdo/dump.c | 12 +- drivers/md/dm-vdo/flush.c | 32 ++--- drivers/md/dm-vdo/flush.h | 2 +- drivers/md/dm-vdo/physical-zone.c | 4 +- drivers/md/dm-vdo/recovery-journal.c | 69 +++++----- drivers/md/dm-vdo/recovery-journal.h | 10 +- drivers/md/dm-vdo/slab-depot.c | 99 +++++++------- drivers/md/dm-vdo/slab-depot.h | 22 ++-- drivers/md/dm-vdo/vio.c | 12 +- drivers/md/dm-vdo/vio.h | 2 +- drivers/md/dm-vdo/wait-queue.c | 190 ++++++++++++++------------- drivers/md/dm-vdo/wait-queue.h | 130 +++++++++--------- 17 files changed, 413 insertions(+), 389 deletions(-)
drivers/md/dm-vdo/block-map.c +70 -64
@@ -85,7 +85,7 @@ struct cursor_level {struct cursors ;struct cursor { -struct waiter waiter; +struct vdo_waiter waiter;struct block_map_tree *tree;height_t height;struct cursors *parent;
@@ -162,7 +162,7 @@ static char *get_page_buffer(struct page_info *info)return &cache->pages[(info - cache->infos) *VDO_BLOCK_SIZE ]; } -static inline struct vdo_page_completion *page_completion_from_waiter (struct waiter *waiter) +static inline struct vdo_page_completion *page_completion_from_waiter (struct vdo_waiter *waiter) {struct vdo_page_completion *completion;
@@ -407,7 +407,7 @@ static int reset_page_info(struct page_info *info)if (result !=UDS_SUCCESS )return result; - result =ASSERT (!vdo_has_waiters (&info->waiting), + result =ASSERT (!vdo_waitq_has_waiters (&info->waiting),"VDO Page must not have waiters" );if (result !=UDS_SUCCESS )return result;
@@ -506,7 +506,7 @@ static void complete_with_page(struct page_info *info,* * Implements waiter_callback_fn. */ -static void complete_waiter_with_error (struct waiter *waiter,void *result_ptr) +static void complete_waiter_with_error (struct vdo_waiter *waiter,void *result_ptr) {int *result = result_ptr;
@@ -520,25 +520,25 @@ static void complete_waiter_with_error(struct waiter *waiter, void *result_ptr)* * Implements waiter_callback_fn. */ -static void complete_waiter_with_page (struct waiter *waiter,void *page_info) +static void complete_waiter_with_page (struct vdo_waiter *waiter,void *page_info) {complete_with_page (page_info,page_completion_from_waiter (waiter)); }/** -* distribute_page_over_queue() - Complete a queue of VDO page completions with a page result. +* distribute_page_over_waitq() - Complete a waitq of VDO page completions with a page result. * -* Upon completion the queue will be empty. +* Upon completion the waitq will be empty. * * Return: The number of pages distributed. */ -static unsigned int distribute_page_over_queue (struct page_info *info, -struct wait_queue *queue) +static unsigned int distribute_page_over_waitq (struct page_info *info, +struct vdo_wait_queue *waitq) {size_t pages;update_lru (info); - pages =vdo_count_waiters (queue); + pages =vdo_waitq_num_waiters (waitq);/* * Increment the busy count once for each pending completion so that this page does not
@@ -546,7 +546,7 @@ static unsigned int distribute_page_over_queue(struct page_info *info,*/ info->busy += pages; -vdo_notify_all_waiters (queue, complete_waiter_with_page, info); +vdo_waitq_notify_all_waiters (waitq, complete_waiter_with_page, info);return pages; }
@@ -572,13 +572,14 @@ static void set_persistent_error(struct vdo_page_cache *cache, const char *conteassert_on_cache_thread (cache, __func__); -vdo_notify_all_waiters (&cache->free_waiters, complete_waiter_with_error, - &result); +vdo_waitq_notify_all_waiters (&cache->free_waiters, + complete_waiter_with_error, &result); cache->waiter_count =0 ; -for (info = cache->infos; info < cache->infos + cache->page_count; info++) -vdo_notify_all_waiters (&info->waiting, complete_waiter_with_error, - &result); +for (info = cache->infos; info < cache->infos + cache->page_count; info++) { +vdo_waitq_notify_all_waiters (&info->waiting, + complete_waiter_with_error, &result); + } }/**
@@ -625,7 +626,7 @@ static void check_for_drain_complete(struct block_map_zone *zone) {if (vdo_is_state_draining (&zone->state) && (zone->active_lookups ==0 ) && - !vdo_has_waiters (&zone->flush_waiters) && + !vdo_waitq_has_waiters (&zone->flush_waiters) && !is_vio_pool_busy (zone->vio_pool) && (zone->page_cache.outstanding_reads ==0 ) && (zone->page_cache.outstanding_writes ==0 )) {
@@ -643,8 +644,8 @@ static void enter_zone_read_only_mode(struct block_map_zone *zone, int result)* We are in read-only mode, so we won't ever write any page out. Just take all waiters off * the queue so the zone can drain. */ -while (vdo_has_waiters (&zone->flush_waiters)) -vdo_dequeue_next_waiter (&zone->flush_waiters); +while (vdo_waitq_has_waiters (&zone->flush_waiters)) +vdo_waitq_dequeue_next_waiter (&zone->flush_waiters);check_for_drain_complete (zone); }
@@ -677,7 +678,7 @@ static void handle_load_error(struct vdo_completion *completion)vdo_enter_read_only_mode (cache->zone->block_map->vdo, result);ADD_ONCE (cache->stats.failed_reads,1 );set_info_state (info,PS_FAILED ); -vdo_notify_all_waiters (&info->waiting, complete_waiter_with_error, &result); +vdo_waitq_notify_all_waiters (&info->waiting, complete_waiter_with_error, &result);reset_page_info (info);/*
@@ -720,7 +721,7 @@ static void page_is_loaded(struct vdo_completion *completion) info->recovery_lock =0 ;set_info_state (info,PS_RESIDENT ); -distribute_page_over_queue (info, &info->waiting); +distribute_page_over_waitq (info, &info->waiting);/* * Don't decrement until right before calling check_for_drain_complete() to
@@ -874,7 +875,7 @@ static void launch_page_save(struct page_info *info)* * Return: true if the page completion is for the desired page number. */ -static bool completion_needs_page (struct waiter *waiter,void *context) +static bool completion_needs_page (struct vdo_waiter *waiter,void *context) {physical_block_number_t *pbn = context;
@@ -888,13 +889,13 @@ static bool completion_needs_page(struct waiter *waiter, void *context)static void allocate_free_page (struct page_info *info) {int result; -struct waiter *oldest_waiter; +struct vdo_waiter *oldest_waiter;physical_block_number_t pbn;struct vdo_page_cache *cache = info->cache;assert_on_cache_thread (cache, __func__); -if (!vdo_has_waiters (&cache->free_waiters)) { +if (!vdo_waitq_has_waiters (&cache->free_waiters)) {if (cache->stats.cache_pressure >0 ) {uds_log_info ("page cache pressure relieved" );WRITE_ONCE (cache->stats.cache_pressure,0 );
@@ -909,20 +910,22 @@ static void allocate_free_page(struct page_info *info)return ; } - oldest_waiter =vdo_get_first_waiter (&cache->free_waiters); + oldest_waiter =vdo_waitq_get_first_waiter (&cache->free_waiters); pbn =page_completion_from_waiter (oldest_waiter)->pbn;/* * Remove all entries which match the page number in question and push them onto the page * info's wait queue. */ -vdo_dequeue_matching_waiters (&cache->free_waiters, completion_needs_page, - &pbn, &info->waiting); - cache->waiter_count -=vdo_count_waiters (&info->waiting); +vdo_waitq_dequeue_matching_waiters (&cache->free_waiters, completion_needs_page, + &pbn, &info->waiting); + cache->waiter_count -=vdo_waitq_num_waiters (&info->waiting); result =launch_page_load (info, pbn); -if (result !=VDO_SUCCESS ) -vdo_notify_all_waiters (&info->waiting, complete_waiter_with_error, &result); +if (result !=VDO_SUCCESS ) { +vdo_waitq_notify_all_waiters (&info->waiting, + complete_waiter_with_error, &result); + } }/**
@@ -966,7 +969,7 @@ static void discard_page_for_completion(struct vdo_page_completion *vdo_page_comstruct vdo_page_cache *cache = vdo_page_comp->cache; cache->waiter_count++; -vdo_enqueue_waiter (&cache->free_waiters, &vdo_page_comp->waiter); +vdo_waitq_enqueue_waiter (&cache->free_waiters, &vdo_page_comp->waiter);discard_a_page (cache); }
@@ -1069,11 +1072,11 @@ static void page_is_written_out(struct vdo_completion *completion) cache->zone->zone_number); info->recovery_lock =0 ; was_discard =write_has_finished (info); - reclaimed = (!was_discard || (info->busy >0 ) ||vdo_has_waiters (&info->waiting)); + reclaimed = (!was_discard || (info->busy >0 ) ||vdo_waitq_has_waiters (&info->waiting));set_info_state (info,PS_RESIDENT ); - reclamations =distribute_page_over_queue (info, &info->waiting); + reclamations =distribute_page_over_waitq (info, &info->waiting);ADD_ONCE (cache->stats.reclaimed, reclamations);if (was_discard)
@@ -1187,10 +1190,12 @@ static void load_page_for_completion(struct page_info *info, {int result; -vdo_enqueue_waiter (&info->waiting, &vdo_page_comp->waiter); +vdo_waitq_enqueue_waiter (&info->waiting, &vdo_page_comp->waiter); result =launch_page_load (info, vdo_page_comp->pbn); -if (result !=VDO_SUCCESS ) -vdo_notify_all_waiters (&info->waiting, complete_waiter_with_error, &result); +if (result !=VDO_SUCCESS ) { +vdo_waitq_notify_all_waiters (&info->waiting, + complete_waiter_with_error, &result); + } }/**
@@ -1251,7 +1256,7 @@ void vdo_get_page(struct vdo_page_completion *page_completion, (is_outgoing(info) && page_completion->writable)) {/* The page is unusable until it has finished I/O. */ ADD_ONCE (cache->stats.wait_for_page,1 ); -vdo_enqueue_waiter (&info->waiting, &page_completion->waiter); +vdo_waitq_enqueue_waiter (&info->waiting, &page_completion->waiter);return ; }
@@ -1476,7 +1481,7 @@ static void set_generation(struct block_map_zone *zone, struct tree_page *page, {u32 new_count;int result; -bool decrement_old =vdo_is_waiting (&page->waiter); +bool decrement_old =vdo_waiter_is_waiting (&page->waiter);u8 old_generation = page->generation;if (decrement_old && (old_generation == new_generation))
@@ -1498,12 +1503,12 @@ static void set_generation(struct block_map_zone *zone, struct tree_page *page,static void write_page (struct tree_page *tree_page,struct pooled_vio *vio);/* Implements waiter_callback_fn */ -static void write_page_callback (struct waiter *waiter,void *context) +static void write_page_callback (struct vdo_waiter *waiter,void *context) { write_page(container_of(waiter, struct tree_page, waiter), context); } -static void acquire_vio (struct waiter *waiter,struct block_map_zone *zone) +static void acquire_vio (struct vdo_waiter *waiter,struct block_map_zone *zone) { waiter->callback = write_page_callback;acquire_vio_from_pool (zone->vio_pool, waiter);
@@ -1530,10 +1535,10 @@ static void enqueue_page(struct tree_page *page, struct block_map_zone *zone)return ; } -vdo_enqueue_waiter (&zone->flush_waiters, &page->waiter); +vdo_waitq_enqueue_waiter (&zone->flush_waiters, &page->waiter); } -static void write_page_if_not_dirtied (struct waiter *waiter,void *context) +static void write_page_if_not_dirtied (struct vdo_waiter *waiter,void *context) { struct tree_page *page = container_of(waiter, struct tree_page, waiter);struct write_if_not_dirtied_context *write_context = context;
@@ -1576,8 +1581,8 @@ static void finish_page_write(struct vdo_completion *completion) .generation = page->writing_generation, }; -vdo_notify_all_waiters (&zone->flush_waiters, - write_page_if_not_dirtied, &context); +vdo_waitq_notify_all_waiters (&zone->flush_waiters, + write_page_if_not_dirtied, &context);if (dirty &&attempt_increment (zone)) {write_page (page, pooled);return ;
@@ -1588,10 +1593,10 @@ static void finish_page_write(struct vdo_completion *completion)if (dirty) {enqueue_page (page, zone); - }else if ((zone->flusher ==NULL ) &&vdo_has_waiters (&zone->flush_waiters) && + }else if ((zone->flusher ==NULL ) &&vdo_waitq_has_waiters (&zone->flush_waiters) &&attempt_increment (zone)) { zone->flusher = -container_of (vdo_dequeue_next_waiter (&zone->flush_waiters), +container_of (vdo_waitq_dequeue_next_waiter (&zone->flush_waiters), struct tree_page, waiter);write_page (zone->flusher, pooled);return ;
@@ -1724,9 +1729,9 @@ static void finish_lookup(struct data_vio *data_vio, int result)continue_data_vio_with_error (data_vio, result); } -static void abort_lookup_for_waiter (struct waiter *waiter,void *context) +static void abort_lookup_for_waiter (struct vdo_waiter *waiter,void *context) { -struct data_vio *data_vio =waiter_as_data_vio (waiter); +struct data_vio *data_vio =vdo_waiter_as_data_vio (waiter);int result = *((int *) context);if (!data_vio->write) {
@@ -1746,8 +1751,9 @@ static void abort_lookup(struct data_vio *data_vio, int result, char *what)if (data_vio->tree_lock.locked) {release_page_lock (data_vio, what); -vdo_notify_all_waiters (&data_vio->tree_lock.waiters, - abort_lookup_for_waiter, &result); +vdo_waitq_notify_all_waiters (&data_vio->tree_lock.waiters, + abort_lookup_for_waiter, + &result); }finish_lookup (data_vio, result);
@@ -1813,9 +1819,9 @@ static void continue_with_loaded_page(struct data_vio *data_vio,load_block_map_page (data_vio->logical.zone->block_map_zone, data_vio); } -static void continue_load_for_waiter (struct waiter *waiter,void *context) +static void continue_load_for_waiter (struct vdo_waiter *waiter,void *context) { -struct data_vio *data_vio =waiter_as_data_vio (waiter); +struct data_vio *data_vio =vdo_waiter_as_data_vio (waiter); data_vio->tree_lock.height--;continue_with_loaded_page (data_vio, context);
@@ -1845,7 +1851,7 @@ static void finish_block_map_page_load(struct vdo_completion *completion)/* Release our claim to the load and wake any waiters */ release_page_lock (data_vio,"load" ); -vdo_notify_all_waiters (&tree_lock->waiters, continue_load_for_waiter, page); +vdo_waitq_notify_all_waiters (&tree_lock->waiters, continue_load_for_waiter, page);continue_with_loaded_page (data_vio, page); }
@@ -1871,10 +1877,10 @@ static void load_page_endio(struct bio *bio) data_vio->logical.zone->thread_id); } -static void load_page (struct waiter *waiter,void *context) +static void load_page (struct vdo_waiter *waiter,void *context) {struct pooled_vio *pooled = context; -struct data_vio *data_vio =waiter_as_data_vio (waiter); +struct data_vio *data_vio =vdo_waiter_as_data_vio (waiter);struct tree_lock *lock = &data_vio->tree_lock;physical_block_number_t pbn = lock->tree_slots[lock->height -1 ].block_map_slot.pbn;
@@ -1916,7 +1922,7 @@ static int attempt_page_lock(struct block_map_zone *zone, struct data_vio *data_ }/* Someone else is loading or allocating the page we need */ -vdo_enqueue_waiter (&lock_holder->waiters, &data_vio->waiter); +vdo_waitq_enqueue_waiter (&lock_holder->waiters, &data_vio->waiter);return VDO_SUCCESS ; }
@@ -1948,9 +1954,9 @@ static void allocation_failure(struct vdo_completion *completion)abort_lookup (data_vio, completion->result,"allocation" ); } -static void continue_allocation_for_waiter (struct waiter *waiter,void *context) +static void continue_allocation_for_waiter (struct vdo_waiter *waiter,void *context) { -struct data_vio *data_vio =waiter_as_data_vio (waiter); +struct data_vio *data_vio =vdo_waiter_as_data_vio (waiter);struct tree_lock *tree_lock = &data_vio->tree_lock;physical_block_number_t pbn = *((physical_block_number_t *) context);
@@ -2010,7 +2016,7 @@ static void write_expired_elements(struct block_map_zone *zone)list_del_init (&page->entry); - result =ASSERT (!vdo_is_waiting (&page->waiter), + result =ASSERT (!vdo_waiter_is_waiting (&page->waiter),"Newly expired page not already waiting to write" );if (result !=VDO_SUCCESS ) {enter_zone_read_only_mode (zone, result);
@@ -2089,7 +2095,7 @@ static void finish_block_map_allocation(struct vdo_completion *completion)VDO_MAPPING_STATE_UNCOMPRESSED , &tree_page->recovery_lock); -if (vdo_is_waiting (&tree_page->waiter)) { +if (vdo_waiter_is_waiting (&tree_page->waiter)) {/* This page is waiting to be written out. */ if (zone->flusher != tree_page) {/*
@@ -2117,8 +2123,8 @@ static void finish_block_map_allocation(struct vdo_completion *completion)/* Release our claim to the allocation and wake any waiters */ release_page_lock (data_vio,"allocation" ); -vdo_notify_all_waiters (&tree_lock->waiters, continue_allocation_for_waiter, - &pbn); +vdo_waitq_notify_all_waiters (&tree_lock->waiters, + continue_allocation_for_waiter, &pbn);if (tree_lock->height ==0 ) {finish_lookup (data_vio,VDO_SUCCESS );return ;
@@ -2324,7 +2330,7 @@ physical_block_number_t vdo_find_block_map_page_pbn(struct block_map *map,*/ void vdo_write_tree_page (struct tree_page *page,struct block_map_zone *zone) { -bool waiting =vdo_is_waiting (&page->waiter); +bool waiting =vdo_waiter_is_waiting (&page->waiter);if (waiting && (zone->flusher == page))return ;
@@ -2630,7 +2636,7 @@ static void traverse(struct cursor *cursor)* * Implements waiter_callback_fn. */ -static void launch_cursor (struct waiter *waiter,void *context) +static void launch_cursor (struct vdo_waiter *waiter,void *context) { struct cursor *cursor = container_of(waiter, struct cursor, waiter);struct pooled_vio *pooled = context;
drivers/md/dm-vdo/block-map.h +5 -5
@@ -68,7 +68,7 @@ struct vdo_page_cache {/* how many VPCs waiting for free page */ unsigned int waiter_count;/* queue of waiters who want a free page */ -struct wait_queue free_waiters; +struct vdo_wait_queue free_waiters;/* * Statistics are only updated on the logical zone thread, but are accessed from other * threads.
@@ -129,7 +129,7 @@ struct page_info {/* page state */ enum vdo_page_buffer_state state;/* queue of completions awaiting this item */ -struct wait_queue waiting; +struct vdo_wait_queue waiting;/* state linked list entry */ struct list_head state_entry;/* LRU entry */
@@ -153,7 +153,7 @@ struct vdo_page_completion {/* The cache involved */ struct vdo_page_cache *cache;/* The waiter for the pending list */ -struct waiter waiter; +struct vdo_waiter waiter;/* The absolute physical block number of the page on disk */ physical_block_number_t pbn;/* Whether the page may be modified */
@@ -167,7 +167,7 @@ struct vdo_page_completion {struct forest ;struct tree_page { -struct waiter waiter; +struct vdo_waiter waiter;/* Dirty list entry */ struct list_head entry;
@@ -228,7 +228,7 @@ struct block_map_zone {struct vio_pool *vio_pool;/* The tree page which has issued or will be issuing a flush */ struct tree_page *flusher; -struct wait_queue flush_waiters; +struct vdo_wait_queue flush_waiters;/* The generation after the most recent flush */ u8 generation;u8 oldest_generation;
drivers/md/dm-vdo/data-vio.c +7 -7
@@ -249,7 +249,7 @@ static void initialize_lbn_lock(struct data_vio *data_vio, logical_block_number_ lock->lbn = lbn; lock->locked = false; -vdo_initialize_wait_queue (&lock->waiters); +vdo_waitq_init (&lock->waiters); zone_number =vdo_compute_logical_zone (data_vio); lock->zone = &vdo->logical_zones->zones[zone_number]; }
@@ -466,7 +466,7 @@ static void attempt_logical_block_lock(struct vdo_completion *completion) } data_vio->last_async_operation =VIO_ASYNC_OP_ATTEMPT_LOGICAL_BLOCK_LOCK ; -vdo_enqueue_waiter (&lock_holder->logical.waiters, &data_vio->waiter); +vdo_waitq_enqueue_waiter (&lock_holder->logical.waiters, &data_vio->waiter);/* * Prevent writes and read-modify-writes from blocking indefinitely on lock holders in the
@@ -1191,11 +1191,11 @@ static void transfer_lock(struct data_vio *data_vio, struct lbn_lock *lock)/* Another data_vio is waiting for the lock, transfer it in a single lock map operation. */ next_lock_holder = -waiter_as_data_vio (vdo_dequeue_next_waiter (&lock->waiters)); +vdo_waiter_as_data_vio (vdo_waitq_dequeue_next_waiter (&lock->waiters));/* Transfer the remaining lock waiters to the next lock holder. */ -vdo_transfer_all_waiters (&lock->waiters, - &next_lock_holder->logical.waiters); +vdo_waitq_transfer_all_waiters (&lock->waiters, + &next_lock_holder->logical.waiters); result =vdo_int_map_put (lock->zone->lbn_operations, lock->lbn, next_lock_holder, true, (void **) &lock_holder);
@@ -1213,7 +1213,7 @@ static void transfer_lock(struct data_vio *data_vio, struct lbn_lock *lock)* If there are still waiters, other data_vios must be trying to get the lock we just * transferred. We must ensure that the new lock holder doesn't block in the packer. */ -if (vdo_has_waiters (&next_lock_holder->logical.waiters)) +if (vdo_waitq_has_waiters (&next_lock_holder->logical.waiters))cancel_data_vio_compression (next_lock_holder);/*
@@ -1235,7 +1235,7 @@ static void release_logical_lock(struct vdo_completion *completion)assert_data_vio_in_logical_zone (data_vio); -if (vdo_has_waiters (&lock->waiters)) +if (vdo_waitq_has_waiters (&lock->waiters))transfer_lock (data_vio, lock);else release_lock (data_vio, lock);
drivers/md/dm-vdo/data-vio.h +6 -6
@@ -54,7 +54,7 @@ enum async_operation_number {struct lbn_lock {logical_block_number_t lbn;bool locked; -struct wait_queue waiters; +struct vdo_wait_queue waiters;struct logical_zone *zone; };
@@ -75,7 +75,7 @@ struct tree_lock {/* The key for the lock map */ u64 key;/* The queue of waiters for the page this vio is allocating or loading */ -struct wait_queue waiters; +struct vdo_wait_queue waiters;/* The block map tree slots for this LBN */ struct block_map_tree_slot tree_slots[VDO_BLOCK_MAP_TREE_HEIGHT +1 ]; };
@@ -168,13 +168,13 @@ struct reference_updater {bool increment;struct zoned_pbn zpbn;struct pbn_lock *lock; -struct waiter waiter; +struct vdo_waiter waiter; };/* A vio for processing user data requests. */ struct data_vio { -/* The wait_queue entry structure */ -struct waiter waiter; +/* The vdo_wait_queue entry structure */ +struct vdo_waiter waiter;/* The logical block of this request */ struct lbn_lock logical;
@@ -288,7 +288,7 @@ static inline struct data_vio *as_data_vio(struct vdo_completion *completion)return vio_as_data_vio (as_vio (completion)); } -static inline struct data_vio *waiter_as_data_vio (struct waiter *waiter) +static inline struct data_vio *vdo_waiter_as_data_vio (struct vdo_waiter *waiter) {if (waiter ==NULL )return NULL ;
drivers/md/dm-vdo/dedupe.c +24 -24
177 lines not on this page · raw message
drivers/md/dm-vdo/dump.c +6 -6
@@ -146,25 +146,25 @@ void vdo_dump_all(struct vdo *vdo, const char *why) }/* -* Dump out the data_vio waiters on a wait queue. +* Dump out the data_vio waiters on a waitq. * wait_on should be the label to print for queue (e.g. logical or physical) */ -static void dump_vio_waiters (struct wait_queue *queue,char *wait_on) +static void dump_vio_waiters (struct vdo_wait_queue *waitq,char *wait_on) { -struct waiter *waiter, *first =vdo_get_first_waiter (queue); +struct vdo_waiter *waiter, *first =vdo_waitq_get_first_waiter (waitq);struct data_vio *data_vio;if (first ==NULL )return ; - data_vio =waiter_as_data_vio (first); + data_vio =vdo_waiter_as_data_vio (first);uds_log_info (" %s is locked. Waited on by: vio %px pbn %llu lbn %llu d-pbn %llu lastOp %s" , wait_on, data_vio, data_vio->allocation.pbn, data_vio->logical.lbn, data_vio->duplicate.pbn,get_data_vio_operation_name (data_vio));for (waiter = first->next_waiter; waiter != first; waiter = waiter->next_waiter) { - data_vio =waiter_as_data_vio (waiter); + data_vio =vdo_waiter_as_data_vio (waiter); uds_log_info(" ... and : vio %px pbn %llu lbn %llu d-pbn %llu lastOp %s", data_vio, data_vio->allocation.pbn, data_vio->logical.lbn, data_vio->duplicate.pbn,
@@ -177,7 +177,7 @@ static void dump_vio_waiters(struct wait_queue *queue, char *wait_on)* logging brevity: * * R => vio completion result not VDO_SUCCESS -* W => vio is on a wait queue +* W => vio is on a waitq * D => vio is a duplicate * p => vio is a partial block operation * z => vio is a zero block
drivers/md/dm-vdo/flush.c +17 -15
@@ -31,9 +31,9 @@ struct flusher {/** The first unacknowledged flush generation */ sequence_number_t first_unacknowledged_generation;/** The queue of flush requests waiting to notify other threads */ -struct wait_queue notifiers; +struct vdo_wait_queue notifiers;/** The queue of flush requests waiting for VIOs to complete */ -struct wait_queue pending_flushes; +struct vdo_wait_queue pending_flushes;/** The flush generation for which notifications are being sent */ sequence_number_t notify_generation;/** The logical zone to notify next */
@@ -93,7 +93,7 @@ static inline struct vdo_flush *completion_as_vdo_flush(struct vdo_completion *c* * Return: The wait queue entry as a vdo_flush. */ -static struct vdo_flush *waiter_as_flush (struct waiter *waiter) +static struct vdo_flush *vdo_waiter_as_flush (struct vdo_waiter *waiter) { return container_of(waiter, struct vdo_flush, waiter); }
@@ -195,10 +195,10 @@ static void finish_notification(struct vdo_completion *completion)assert_on_flusher_thread (flusher, __func__); -vdo_enqueue_waiter (&flusher->pending_flushes, -vdo_dequeue_next_waiter (&flusher->notifiers)); +vdo_waitq_enqueue_waiter (&flusher->pending_flushes, +vdo_waitq_dequeue_next_waiter (&flusher->notifiers));vdo_complete_flushes (flusher); -if (vdo_has_waiters (&flusher->notifiers)) +if (vdo_waitq_has_waiters (&flusher->notifiers))notify_flush (flusher); }
@@ -248,7 +248,8 @@ static void increment_generation(struct vdo_completion *completion)*/ static void notify_flush (struct flusher *flusher) { -struct vdo_flush *flush =waiter_as_flush (vdo_get_first_waiter (&flusher->notifiers)); +struct vdo_flush *flush = +vdo_waiter_as_flush (vdo_waitq_get_first_waiter (&flusher->notifiers)); flusher->notify_generation = flush->flush_generation; flusher->logical_zone_to_notify = &flusher->vdo->logical_zones->zones[0 ];
@@ -280,8 +281,8 @@ static void flush_vdo(struct vdo_completion *completion) } flush->flush_generation = flusher->flush_generation++; - may_notify = !vdo_has_waiters (&flusher->notifiers); -vdo_enqueue_waiter (&flusher->notifiers, &flush->waiter); + may_notify = !vdo_waitq_has_waiters (&flusher->notifiers); +vdo_waitq_enqueue_waiter (&flusher->notifiers, &flush->waiter);if (may_notify)notify_flush (flusher); }
@@ -294,7 +295,8 @@ static void check_for_drain_complete(struct flusher *flusher) {bool drained; -if (!vdo_is_state_draining (&flusher->state) ||vdo_has_waiters (&flusher->pending_flushes)) +if (!vdo_is_state_draining (&flusher->state) || +vdo_waitq_has_waiters (&flusher->pending_flushes))return ;spin_lock (&flusher->lock);
@@ -321,9 +323,9 @@ void vdo_complete_flushes(struct flusher *flusher)min (oldest_active_generation,READ_ONCE (zone->oldest_active_generation)); -while (vdo_has_waiters (&flusher->pending_flushes)) { +while (vdo_waitq_has_waiters (&flusher->pending_flushes)) {struct vdo_flush *flush = -waiter_as_flush (vdo_get_first_waiter (&flusher->pending_flushes)); +vdo_waiter_as_flush (vdo_waitq_get_first_waiter (&flusher->pending_flushes));if (flush->flush_generation >= oldest_active_generation)return ;
@@ -333,7 +335,7 @@ void vdo_complete_flushes(struct flusher *flusher)"acknowledged next expected flush, %llu, was: %llu" , (unsigned long long ) flusher->first_unacknowledged_generation, (unsigned long long) flush->flush_generation); -vdo_dequeue_next_waiter (&flusher->pending_flushes); +vdo_waitq_dequeue_next_waiter (&flusher->pending_flushes);vdo_complete_flush (flush); flusher->first_unacknowledged_generation++; }
@@ -352,8 +354,8 @@ void vdo_dump_flusher(const struct flusher *flusher) (unsigned long long ) flusher->flush_generation, (unsigned long long) flusher->first_unacknowledged_generation);uds_log_info (" notifiers queue is %s; pending_flushes queue is %s" , - (vdo_has_waiters (&flusher->notifiers) ?"not empty" :"empty" ), - (vdo_has_waiters (&flusher->pending_flushes) ?"not empty" :"empty" )); + (vdo_waitq_has_waiters (&flusher->notifiers) ?"not empty" :"empty" ), + (vdo_waitq_has_waiters (&flusher->pending_flushes) ?"not empty" :"empty" )); }/**
drivers/md/dm-vdo/flush.h +1 -1
@@ -18,7 +18,7 @@ struct vdo_flush {/* The flush bios covered by this request */ struct bio_list bios;/* The wait queue entry for this flush */ -struct waiter waiter; +struct vdo_waiter waiter;/* Which flush this struct represents */ sequence_number_t flush_generation; };
drivers/md/dm-vdo/physical-zone.c +2 -2
@@ -519,9 +519,9 @@ static int allocate_and_lock_block(struct allocation *allocation)* @waiter: The allocating_vio that was waiting to allocate. * @context: The context (unused). */ -static void retry_allocation (struct waiter *waiter,void *context__always_unused ) +static void retry_allocation (struct vdo_waiter *waiter,void *context__always_unused ) { -struct data_vio *data_vio =waiter_as_data_vio (waiter); +struct data_vio *data_vio =vdo_waiter_as_data_vio (waiter);/* Now that some slab has scrubbed, restart the allocation process. */ data_vio->allocation.wait_for_clean_slab = false;
drivers/md/dm-vdo/recovery-journal.c +36 -33
191 lines not on this page · raw message
drivers/md/dm-vdo/recovery-journal.h +5 -5
@@ -113,7 +113,7 @@ struct recovery_journal_block {/* The doubly linked pointers for the free or active lists */ struct list_head list_node;/* The waiter for the pending full block list */ -struct waiter write_waiter; +struct vdo_waiter write_waiter;/* The journal to which this block belongs */ struct recovery_journal *journal;/* A pointer to the current sector in the packed block buffer */
@@ -133,9 +133,9 @@ struct recovery_journal_block {/* The number of new entries in the current commit */ journal_entry_count_t entries_in_commit;/* The queue of vios which will make entries for the next commit */ -struct wait_queue entry_waiters; +struct vdo_wait_queue entry_waiters;/* The queue of vios waiting for the current commit */ -struct wait_queue commit_waiters; +struct vdo_wait_queue commit_waiters; };struct recovery_journal {
@@ -146,7 +146,7 @@ struct recovery_journal {/* The block map which can hold locks on this journal */ struct block_map *block_map;/* The queue of vios waiting to make entries */ -struct wait_queue entry_waiters; +struct vdo_wait_queue entry_waiters;/* The number of free entries in the journal */ u64 available_space;/* The number of decrement entries which need to be made */
@@ -184,7 +184,7 @@ struct recovery_journal {/* A pointer to the active block (the one we are adding entries to now) */ struct recovery_journal_block *active_block;/* Journal blocks that need writing */ -struct wait_queue pending_writes; +struct vdo_wait_queue pending_writes;/* The new block map reap head after reaping */ sequence_number_t block_map_reap_head;/* The head block number for the block map rebuild range */
drivers/md/dm-vdo/slab-depot.c +50 -49
352 lines not on this page · raw message
drivers/md/dm-vdo/slab-depot.h +11 -11
@@ -60,13 +60,13 @@ struct journal_lock {struct slab_journal {/* A waiter object for getting a VIO pool entry */ -struct waiter resource_waiter; +struct vdo_waiter resource_waiter;/* A waiter object for updating the slab summary */ -struct waiter slab_summary_waiter; +struct vdo_waiter slab_summary_waiter;/* A waiter object for getting a vio with which to flush */ -struct waiter flush_waiter; +struct vdo_waiter flush_waiter;/* The queue of VIOs waiting to make an entry */ -struct wait_queue entry_waiters; +struct vdo_wait_queue entry_waiters;/* The parent slab reference of this journal */ struct vdo_slab *slab;
@@ -149,7 +149,7 @@ struct slab_journal {*/ struct reference_block {/* This block waits on the ref_counts to tell it to write */ -struct waiter waiter; +struct vdo_waiter waiter;/* The slab to which this reference_block belongs */ struct vdo_slab *slab;/* The number of references in this block that represent allocations */
@@ -241,12 +241,12 @@ struct vdo_slab {struct search_cursor search_cursor;/* A list of the dirty blocks waiting to be written out */ -struct wait_queue dirty_blocks; +struct vdo_wait_queue dirty_blocks;/* The number of blocks which are currently writing */ size_t active_count;/* A waiter object for updating the slab summary */ -struct waiter summary_waiter; +struct vdo_waiter summary_waiter;/* The latest slab journal for which there has been a reference count update */ struct journal_point slab_journal_point;
@@ -271,7 +271,7 @@ struct slab_scrubber {/* The queue of slabs to scrub once there are no high_priority_slabs */ struct list_head slabs;/* The queue of VIOs waiting for a slab to be scrubbed */ -struct wait_queue waiters; +struct vdo_wait_queue waiters;/* * The number of slabs that are unrecovered or being scrubbed. This field is modified by
@@ -341,9 +341,9 @@ struct slab_summary_block {/* Whether this block has a write outstanding */ bool writing;/* Ring of updates waiting on the outstanding write */ -struct wait_queue current_update_waiters; +struct vdo_wait_queue current_update_waiters;/* Ring of updates waiting on the next write */ -struct wait_queue next_update_waiters; +struct vdo_wait_queue next_update_waiters;/* The active slab_summary_entry array for this block */ struct slab_summary_entry *entries;/* The vio used to write this block */
@@ -522,7 +522,7 @@ int __must_check vdo_allocate_block(struct block_allocator *allocator, physical_block_number_t *block_number_ptr);int vdo_enqueue_clean_slab_waiter (struct block_allocator *allocator, -struct waiter *waiter); +struct vdo_waiter *waiter);void vdo_modify_reference_count (struct vdo_completion *completion,struct reference_updater *updater);
drivers/md/dm-vdo/vio.c +6 -6
@@ -25,7 +25,7 @@ struct vio_pool {/** The list of objects which are available */ struct list_head available;/** The queue of requestors waiting for objects from the pool */ -struct wait_queue waiting; +struct vdo_wait_queue waiting;/** The number of objects currently in use */ size_t busy_count;/** The list of objects which are in use */
@@ -364,7 +364,7 @@ void free_vio_pool(struct vio_pool *pool)return ;/* Remove all available vios from the object pool. */ -ASSERT_LOG_ONLY (!vdo_has_waiters (&pool->waiting), +ASSERT_LOG_ONLY (!vdo_waitq_has_waiters (&pool->waiting),"VIO pool must not have any waiters when being freed" ); ASSERT_LOG_ONLY((pool->busy_count == 0), "VIO pool must not have %zu busy entries when being freed",
@@ -400,7 +400,7 @@ bool is_vio_pool_busy(struct vio_pool *pool)* @pool: The vio pool. * @waiter: Object that is requesting a vio. */ -void acquire_vio_from_pool (struct vio_pool *pool,struct waiter *waiter) +void acquire_vio_from_pool (struct vio_pool *pool,struct vdo_waiter *waiter) {struct pooled_vio *pooled;
@@ -408,7 +408,7 @@ void acquire_vio_from_pool(struct vio_pool *pool, struct waiter *waiter) "acquire from active vio_pool called from correct thread");if (list_empty (&pool->available)) { -vdo_enqueue_waiter (&pool->waiting, waiter); +vdo_waitq_enqueue_waiter (&pool->waiting, waiter);return ; }
@@ -430,8 +430,8 @@ void return_vio_to_pool(struct vio_pool *pool, struct pooled_vio *vio) vio->vio.completion.error_handler =NULL ; vio->vio.completion.parent =NULL ; -if (vdo_has_waiters (&pool->waiting)) { -vdo_notify_next_waiter (&pool->waiting,NULL , vio); +if (vdo_waitq_has_waiters (&pool->waiting)) { +vdo_waitq_notify_next_waiter (&pool->waiting,NULL , vio);return ; }
drivers/md/dm-vdo/vio.h +1 -1
@@ -193,7 +193,7 @@ int __must_check make_vio_pool(struct vdo *vdo, size_t pool_size, thread_id_t th void *context, struct vio_pool **pool_ptr);void free_vio_pool (struct vio_pool *pool);bool __must_check is_vio_pool_busy (struct vio_pool *pool); -void acquire_vio_from_pool (struct vio_pool *pool,struct waiter *waiter); +void acquire_vio_from_pool (struct vio_pool *pool,struct vdo_waiter *waiter);void return_vio_to_pool (struct vio_pool *pool,struct pooled_vio *vio);#endif /* VIO_H */
drivers/md/dm-vdo/wait-queue.c +96 -94
307 lines not on this page · raw message
drivers/md/dm-vdo/wait-queue.h +70 -60
192 lines not on this page · raw message
Signature · 1 line
2.42.0
Matthew Sakai
maintainerPATCH 2/5 dm vdo wait-queue: remove unused debug function vdo_waitq_get_next_waiter
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
--- drivers/md/dm-vdo/wait-queue.c | 18 ------------------ drivers/md/dm-vdo/wait-queue.h | 3 --- 2 files changed, 21 deletions(-)
drivers/md/dm-vdo/wait-queue.c +0 -18
@@ -207,21 +207,3 @@ bool vdo_waitq_notify_next_waiter(struct vdo_wait_queue *waitq,return true; } - -/** -* vdo_waitq_get_next_waiter() - Get the waiter after this one, for debug iteration. -* @waitq: The vdo_wait_queue. -* @waiter: A waiter. -* -* Return: The next waiter, or NULL. -*/ -const struct vdo_waiter *vdo_waitq_get_next_waiter (const struct vdo_wait_queue *waitq, -const struct vdo_waiter *waiter) -{ -struct vdo_waiter *first_waiter =vdo_waitq_get_first_waiter (waitq); - -if (waiter ==NULL ) -return first_waiter; - -return ((waiter->next_waiter != first_waiter) ? waiter->next_waiter :NULL ); -}
drivers/md/dm-vdo/wait-queue.h +0 -3
@@ -135,7 +135,4 @@ static inline size_t __must_check vdo_waitq_num_waiters(const struct vdo_wait_qu return waitq->length; } -const struct vdo_waiter *__must_check -vdo_waitq_get_next_waiter (const struct vdo_wait_queue *waitq,const struct vdo_waiter *waiter); -#endif /* VDO_WAIT_QUEUE_H */
Signature · 1 line
2.42.0
Matthew Sakai
maintainerPATCH 3/5 dm vdo wait-queue: optimize vdo_waitq_dequeue_matching_waiters
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
Remove temporary 'matched_waiters' waitq and just enqueue matched waiters directly to the caller provided 'matched_waitq'.
--- drivers/md/dm-vdo/wait-queue.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/md/dm-vdo/wait-queue.c +2 -6
@@ -129,10 +129,8 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,void *match_context, struct vdo_wait_queue *matched_waitq) { -// FIXME: copying a waitq just to iterate it, with matching, is unfortunate -struct vdo_wait_queue matched_waiters, iteration_waitq; + struct vdo_wait_queue iteration_waitq; -vdo_waitq_init (&matched_waiters);vdo_waitq_init (&iteration_waitq);vdo_waitq_transfer_all_waiters (waitq, &iteration_waitq);
@@ -140,10 +138,8 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,struct vdo_waiter *waiter =vdo_waitq_dequeue_next_waiter (&iteration_waitq);vdo_waitq_enqueue_waiter ((waiter_match (waiter, match_context) ? - &matched_waiters : waitq), waiter); + matched_waitq : waitq), waiter); } - -vdo_waitq_transfer_all_waiters (&matched_waiters, matched_waitq); }/**
Signature · 1 line
2.42.0
Matthew Sakai
maintainerPATCH 4/5 dm vdo block-map: optimize enter_zone_read_only_mode
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
Rather than incrementally dequeue from the zone->flush_waiters vdo_wait_queue, simply re-initialize it.
--- drivers/md/dm-vdo/block-map.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/md/dm-vdo/block-map.c +3 -5
@@ -641,12 +641,10 @@ static void enter_zone_read_only_mode(struct block_map_zone *zone, int result)vdo_enter_read_only_mode (zone->block_map->vdo, result);/* -* We are in read-only mode, so we won't ever write any page out. Just take all waiters off -* the queue so the zone can drain. +* We are in read-only mode, so we won't ever write any page out. +* Just take all waiters off the waitq so the zone can drain. */ -while (vdo_waitq_has_waiters (&zone->flush_waiters)) -vdo_waitq_dequeue_next_waiter (&zone->flush_waiters); - +vdo_waitq_init (&zone->flush_waiters);check_for_drain_complete (zone); }
Signature · 1 line
2.42.0
Matthew Sakai
maintainerPATCH 5/5 dm vdo wait-queue: rename to vdo_waitq_dequeue_waiter
In reply to Matthew SakaiFrom: Mike Snitzer <[email protected]>
Rename vdo_waitq_dequeue_next_waiter to vdo_waitq_dequeue_waiter. The "next" aspect of returned waiter is implied. "next" also isn't informative ("oldest" would be). Removing "next_" adds symmetry to vdo_waitq_enqueue_waiter().
Also fix whitespace and comments from previous waitq commit.
--- drivers/md/dm-vdo/block-map.c | 7 +++---- drivers/md/dm-vdo/data-vio.c | 2 +- drivers/md/dm-vdo/dedupe.c | 4 ++-- drivers/md/dm-vdo/flush.c | 4 ++-- drivers/md/dm-vdo/recovery-journal.c | 2 +- drivers/md/dm-vdo/wait-queue.c | 18 +++++++++--------- drivers/md/dm-vdo/wait-queue.h | 4 ++-- 7 files changed, 20 insertions(+), 21 deletions(-)
drivers/md/dm-vdo/block-map.c +3 -4
@@ -913,7 +913,7 @@ static void allocate_free_page(struct page_info *info)/* * Remove all entries which match the page number in question and push them onto the page -* info's wait queue. +* info's waitq. */ vdo_waitq_dequeue_matching_waiters (&cache->free_waiters, completion_needs_page, &pbn, &info->waiting);
@@ -1593,9 +1593,8 @@ static void finish_page_write(struct vdo_completion *completion)enqueue_page (page, zone); }else if ((zone->flusher ==NULL ) &&vdo_waitq_has_waiters (&zone->flush_waiters) &&attempt_increment (zone)) { - zone->flusher = -container_of (vdo_waitq_dequeue_next_waiter (&zone->flush_waiters), - struct tree_page, waiter); + zone->flusher =container_of (vdo_waitq_dequeue_waiter (&zone->flush_waiters), + struct tree_page, waiter);write_page (zone->flusher, pooled);return ; }
drivers/md/dm-vdo/data-vio.c +1 -1
@@ -1191,7 +1191,7 @@ static void transfer_lock(struct data_vio *data_vio, struct lbn_lock *lock)/* Another data_vio is waiting for the lock, transfer it in a single lock map operation. */ next_lock_holder = -vdo_waiter_as_data_vio (vdo_waitq_dequeue_next_waiter (&lock->waiters)); +vdo_waiter_as_data_vio (vdo_waitq_dequeue_waiter (&lock->waiters));/* Transfer the remaining lock waiters to the next lock holder. */ vdo_waitq_transfer_all_waiters(&lock->waiters,
drivers/md/dm-vdo/dedupe.c +2 -2
@@ -413,14 +413,14 @@ static void set_duplicate_lock(struct hash_lock *hash_lock, struct pbn_lock *pbn }/** -* dequeue_lock_waiter() - Remove the first data_vio from the lock's wait queue and return it. +* dequeue_lock_waiter() - Remove the first data_vio from the lock's waitq and return it. * @lock: The lock containing the wait queue. * * Return: The first (oldest) waiter in the queue, or NULL if the queue is empty. */ static inline struct data_vio *dequeue_lock_waiter (struct hash_lock *lock) { -return vdo_waiter_as_data_vio (vdo_waitq_dequeue_next_waiter (&lock->waiters)); +return vdo_waiter_as_data_vio (vdo_waitq_dequeue_waiter (&lock->waiters)); }/**
drivers/md/dm-vdo/flush.c +2 -2
@@ -196,7 +196,7 @@ static void finish_notification(struct vdo_completion *completion)assert_on_flusher_thread (flusher, __func__);vdo_waitq_enqueue_waiter (&flusher->pending_flushes, -vdo_waitq_dequeue_next_waiter (&flusher->notifiers)); +vdo_waitq_dequeue_waiter (&flusher->notifiers));vdo_complete_flushes (flusher);if (vdo_waitq_has_waiters (&flusher->notifiers))notify_flush (flusher);
@@ -335,7 +335,7 @@ void vdo_complete_flushes(struct flusher *flusher)"acknowledged next expected flush, %llu, was: %llu" , (unsigned long long ) flusher->first_unacknowledged_generation, (unsigned long long) flush->flush_generation); -vdo_waitq_dequeue_next_waiter (&flusher->pending_flushes); +vdo_waitq_dequeue_waiter (&flusher->pending_flushes);vdo_complete_flush (flush); flusher->first_unacknowledged_generation++; }
drivers/md/dm-vdo/recovery-journal.c +1 -1
@@ -1332,7 +1332,7 @@ static void add_queued_recovery_entries(struct recovery_journal_block *block) {while (vdo_waitq_has_waiters (&block->entry_waiters)) {struct data_vio *data_vio = -vdo_waiter_as_data_vio (vdo_waitq_dequeue_next_waiter (&block->entry_waiters)); +vdo_waiter_as_data_vio (vdo_waitq_dequeue_waiter (&block->entry_waiters));struct tree_lock *lock = &data_vio->tree_lock;struct packed_recovery_journal_entry *packed_entry;struct recovery_journal_entry new_entry;
drivers/md/dm-vdo/wait-queue.c +9 -9
@@ -135,7 +135,7 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,vdo_waitq_transfer_all_waiters (waitq, &iteration_waitq);while (vdo_waitq_has_waiters (&iteration_waitq)) { -struct vdo_waiter *waiter =vdo_waitq_dequeue_next_waiter (&iteration_waitq); +struct vdo_waiter *waiter =vdo_waitq_dequeue_waiter (&iteration_waitq);vdo_waitq_enqueue_waiter ((waiter_match (waiter, match_context) ? matched_waitq : waitq), waiter);
@@ -143,15 +143,15 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq, }/** -* vdo_waitq_dequeue_next_waiter() - Remove the first waiter from the head end of a waitq. +* vdo_waitq_dequeue_waiter() - Remove the first (oldest) waiter from a waitq. * @waitq: The vdo_wait_queue from which to remove the first entry. * -* The caller will be responsible for waking the waiter by invoking the correct callback function -* to resume its execution. +* The caller will be responsible for waking the waiter by continuing its +* execution appropriately. * * Return: The first (oldest) waiter in the waitq, or NULL if the waitq is empty. */ -struct vdo_waiter *vdo_waitq_dequeue_next_waiter (struct vdo_wait_queue *waitq) +struct vdo_waiter *vdo_waitq_dequeue_waiter (struct vdo_wait_queue *waitq) {struct vdo_waiter *first_waiter =vdo_waitq_get_first_waiter (waitq);struct vdo_waiter *last_waiter = waitq->last_waiter;
@@ -160,12 +160,12 @@ struct vdo_waiter *vdo_waitq_dequeue_next_waiter(struct vdo_wait_queue *waitq)return NULL ;if (first_waiter == last_waiter) { -/* The waitq has a single entry, so just empty it out by nulling the tail. */ +/* The waitq has a single entry, so empty it by nulling the tail. */ waitq->last_waiter =NULL ; }else {/* -* The waitq has more than one entry, so splice the first waiter out of the -* circular waitq. +* The waitq has multiple waiters, so splice the first waiter out +* of the circular waitq. */ last_waiter->next_waiter = first_waiter->next_waiter; }
@@ -192,7 +192,7 @@ struct vdo_waiter *vdo_waitq_dequeue_next_waiter(struct vdo_wait_queue *waitq)bool vdo_waitq_notify_next_waiter (struct vdo_wait_queue *waitq,vdo_waiter_callback_fn callback,void *context) { -struct vdo_waiter *waiter =vdo_waitq_dequeue_next_waiter (waitq); +struct vdo_waiter *waiter =vdo_waitq_dequeue_waiter (waitq);if (waiter ==NULL )return false;
drivers/md/dm-vdo/wait-queue.h +2 -2
@@ -106,6 +106,8 @@ static inline bool __must_check vdo_waitq_has_waiters(const struct vdo_wait_queuvoid vdo_waitq_enqueue_waiter (struct vdo_wait_queue *waitq,struct vdo_waiter *waiter); +struct vdo_waiter *vdo_waitq_dequeue_waiter (struct vdo_wait_queue *waitq); +void vdo_waitq_notify_all_waiters (struct vdo_wait_queue *waitq,vdo_waiter_callback_fn callback,void *context);
@@ -122,8 +124,6 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,void *match_context, struct vdo_wait_queue *matched_waitq); -struct vdo_waiter *vdo_waitq_dequeue_next_waiter (struct vdo_wait_queue *waitq); -/** * vdo_waitq_num_waiters() - Return the number of waiters in a vdo_wait_queue. * @waitq: The vdo_wait_queue to query.
Signature · 1 line
2.42.0