dm vdo wait-queue: rename to vdo_waitq_dequeue_waiter

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.

Reviewed-by: Ken Raeburn <raeburn@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
This commit is contained in:
Mike Snitzer 2023-11-20 17:29:20 -05:00
parent 29f0ef873c
commit a4bba246ec
7 changed files with 20 additions and 21 deletions

View file

@ -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;
}

View file

@ -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,

View file

@ -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));
}
/**

View file

@ -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++;
}

View file

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

View file

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

View file

@ -106,6 +106,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);
@ -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.