diff options
author | Mike Snitzer <snitzer@kernel.org> | 2023-08-30 15:04:16 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-08-30 15:35:27 -0400 |
commit | e6cdff7f7c32d1269c16a6da530cb6a3ae9ade88 (patch) | |
tree | 24d9b2313213670ab1580be0dc3308ad8b606e4c | |
parent | 1cc3647b3f1c93f2c358cfd4b79a161994decac5 (diff) | |
download | linux-dm-6.5-vdo.tar.gz |
dm vdo wait-queue: rename to vdo_waitq_dequeue_waiterdm-6.5-vdo-v2dm-6.5-vdo
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.
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
-rw-r--r-- | drivers/md/dm-vdo/block-map.c | 9 | ||||
-rw-r--r-- | drivers/md/dm-vdo/data-vio.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-vdo/dedupe.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-vdo/flush.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-vdo/recovery-journal.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-vdo/wait-queue.c | 19 | ||||
-rw-r--r-- | drivers/md/dm-vdo/wait-queue.h | 4 |
7 files changed, 22 insertions, 22 deletions
diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c index ad79a7d196b660..7e48399d714df5 100644 --- a/drivers/md/dm-vdo/block-map.c +++ b/drivers/md/dm-vdo/block-map.c @@ -887,10 +887,10 @@ 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); + &pbn, &info->waiting); cache->waiter_count -= vdo_waitq_num_waiters(&info->waiting); result = launch_page_load(info, pbn); @@ -1558,9 +1558,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; } diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c index 389e5698ee4be8..6adb672fc9dfc7 100644 --- a/drivers/md/dm-vdo/data-vio.c +++ b/drivers/md/dm-vdo/data-vio.c @@ -1186,7 +1186,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, diff --git a/drivers/md/dm-vdo/dedupe.c b/drivers/md/dm-vdo/dedupe.c index a2eb5f3cdfce21..23fd8ea3eb27bb 100644 --- a/drivers/md/dm-vdo/dedupe.c +++ b/drivers/md/dm-vdo/dedupe.c @@ -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)); } /** diff --git a/drivers/md/dm-vdo/flush.c b/drivers/md/dm-vdo/flush.c index e040c53723ec69..62a09d3fcc4246 100644 --- a/drivers/md/dm-vdo/flush.c +++ b/drivers/md/dm-vdo/flush.c @@ -195,7 +195,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); @@ -333,7 +333,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++; } diff --git a/drivers/md/dm-vdo/recovery-journal.c b/drivers/md/dm-vdo/recovery-journal.c index da1681244c9e1e..7cffd2a707834c 100644 --- a/drivers/md/dm-vdo/recovery-journal.c +++ b/drivers/md/dm-vdo/recovery-journal.c @@ -1341,7 +1341,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; diff --git a/drivers/md/dm-vdo/wait-queue.c b/drivers/md/dm-vdo/wait-queue.c index fb171d462f64ee..00a7435785bbf9 100644 --- a/drivers/md/dm-vdo/wait-queue.c +++ b/drivers/md/dm-vdo/wait-queue.c @@ -137,7 +137,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); @@ -145,15 +145,16 @@ 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 waitq 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 invoking the correct + * callback function to resume its execution. + * FIXME: do all callers simply execute a callback!? just use vdo_waitq_notify_next_waiter? * * 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; @@ -162,12 +163,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; } @@ -194,7 +195,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; diff --git a/drivers/md/dm-vdo/wait-queue.h b/drivers/md/dm-vdo/wait-queue.h index 5e895bcd44ed8c..cbeee7f51d3f37 100644 --- a/drivers/md/dm-vdo/wait-queue.h +++ b/drivers/md/dm-vdo/wait-queue.h @@ -105,6 +105,8 @@ static inline bool __must_check vdo_waitq_has_waiters(const struct vdo_wait_queu void 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); @@ -121,8 +123,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. |