aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-11-20 17:29:20 -0500
committerMike Snitzer <snitzer@kernel.org>2024-02-20 13:43:16 -0500
commita4bba246ecdea4bf73602dcedbc9091656d63872 (patch)
treed58b9e3f3794720d226c028a7bfdc03b6d1a18e6 /drivers/md
parent29f0ef873c5ab5d8d59553447e4175e90287e731 (diff)
downloadlinux-a4bba246ecdea4bf73602dcedbc9091656d63872.tar.gz
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>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-vdo/block-map.c7
-rw-r--r--drivers/md/dm-vdo/data-vio.c2
-rw-r--r--drivers/md/dm-vdo/dedupe.c4
-rw-r--r--drivers/md/dm-vdo/flush.c4
-rw-r--r--drivers/md/dm-vdo/recovery-journal.c2
-rw-r--r--drivers/md/dm-vdo/wait-queue.c18
-rw-r--r--drivers/md/dm-vdo/wait-queue.h4
7 files changed, 20 insertions, 21 deletions
diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c
index 7f9c4bc05f025..c5cb9da5d33e0 100644
--- a/drivers/md/dm-vdo/block-map.c
+++ b/drivers/md/dm-vdo/block-map.c
@@ -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;
}
diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c
index 821155ca3761e..711396e7a77d8 100644
--- a/drivers/md/dm-vdo/data-vio.c
+++ b/drivers/md/dm-vdo/data-vio.c
@@ -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,
diff --git a/drivers/md/dm-vdo/dedupe.c b/drivers/md/dm-vdo/dedupe.c
index 02e36896ca3cf..f882d56581dc2 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 e7195c677773e..a6eeb425d721c 100644
--- a/drivers/md/dm-vdo/flush.c
+++ b/drivers/md/dm-vdo/flush.c
@@ -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++;
}
diff --git a/drivers/md/dm-vdo/recovery-journal.c b/drivers/md/dm-vdo/recovery-journal.c
index 5126e670e97e5..a6981e5dd0179 100644
--- a/drivers/md/dm-vdo/recovery-journal.c
+++ b/drivers/md/dm-vdo/recovery-journal.c
@@ -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;
diff --git a/drivers/md/dm-vdo/wait-queue.c b/drivers/md/dm-vdo/wait-queue.c
index 7e4cf9f03249b..6e1e739277ef7 100644
--- a/drivers/md/dm-vdo/wait-queue.c
+++ b/drivers/md/dm-vdo/wait-queue.c
@@ -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;
diff --git a/drivers/md/dm-vdo/wait-queue.h b/drivers/md/dm-vdo/wait-queue.h
index e514bdcf7d328..7e8ee6afe7c7a 100644
--- a/drivers/md/dm-vdo/wait-queue.h
+++ b/drivers/md/dm-vdo/wait-queue.h
@@ -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.