/*
* 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);
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;
}
/* 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,
}
/**
- * 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));
}
/**
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);
"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++;
}
{
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;
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);
}
/**
- * 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;
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;
}
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;
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);
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.