dm vdo wait-queue: rename to vdo_waitq_dequeue_waiter
authorMike Snitzer <snitzer@kernel.org>
Mon, 20 Nov 2023 22:29:20 +0000 (17:29 -0500)
committerMike Snitzer <snitzer@kernel.org>
Tue, 20 Feb 2024 18:43:16 +0000 (13:43 -0500)
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>
drivers/md/dm-vdo/block-map.c
drivers/md/dm-vdo/data-vio.c
drivers/md/dm-vdo/dedupe.c
drivers/md/dm-vdo/flush.c
drivers/md/dm-vdo/recovery-journal.c
drivers/md/dm-vdo/wait-queue.c
drivers/md/dm-vdo/wait-queue.h

index 7f9c4bc05f0254003abf34c6c6d7b1cce86159df..c5cb9da5d33e0e6b5fdf53d0f080db58d0193fa7 100644 (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;
        }
index 821155ca3761eac1f48f1102727315b1d10cc141..711396e7a77d8faff8ff82fc12f8a8c933255cfc 100644 (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,
index 02e36896ca3cf7a22a9264c37a46d7647e92b51b..f882d56581dc2f934137171c563bbb43b1fd319b 100644 (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));
 }
 
 /**
index e7195c677773e5bc084fd8f0da6561012fc44ea3..a6eeb425d721c319f06b63e50ad20e2e8dc8def4 100644 (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++;
        }
index 5126e670e97e582f507047e6815e939c0cb4bfcf..a6981e5dd017911f689b2a1b76b799831ba77748 100644 (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;
index 7e4cf9f03249b889b5b5c2e91b179a00363deb96..6e1e739277ef7ab89d092922506e758db17506f1 100644 (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;
index e514bdcf7d328ba9b761a5084f520012d69bde1c..7e8ee6afe7c7a8269f783992e4d217ffd939cc2f 100644 (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.