Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+20 -21
+3 -4
drivers/md/dm-vdo/block-map.c
··· 913 913 914 914 /* 915 915 * Remove all entries which match the page number in question and push them onto the page 916 - * info's wait queue. 916 + * info's waitq. 917 917 */ 918 918 vdo_waitq_dequeue_matching_waiters(&cache->free_waiters, completion_needs_page, 919 919 &pbn, &info->waiting); ··· 1593 1593 enqueue_page(page, zone); 1594 1594 } else if ((zone->flusher == NULL) && vdo_waitq_has_waiters(&zone->flush_waiters) && 1595 1595 attempt_increment(zone)) { 1596 - zone->flusher = 1597 - container_of(vdo_waitq_dequeue_next_waiter(&zone->flush_waiters), 1598 - struct tree_page, waiter); 1596 + zone->flusher = container_of(vdo_waitq_dequeue_waiter(&zone->flush_waiters), 1597 + struct tree_page, waiter); 1599 1598 write_page(zone->flusher, pooled); 1600 1599 return; 1601 1600 }
+1 -1
drivers/md/dm-vdo/data-vio.c
··· 1191 1191 1192 1192 /* Another data_vio is waiting for the lock, transfer it in a single lock map operation. */ 1193 1193 next_lock_holder = 1194 - vdo_waiter_as_data_vio(vdo_waitq_dequeue_next_waiter(&lock->waiters)); 1194 + vdo_waiter_as_data_vio(vdo_waitq_dequeue_waiter(&lock->waiters)); 1195 1195 1196 1196 /* Transfer the remaining lock waiters to the next lock holder. */ 1197 1197 vdo_waitq_transfer_all_waiters(&lock->waiters,
+2 -2
drivers/md/dm-vdo/dedupe.c
··· 413 413 } 414 414 415 415 /** 416 - * dequeue_lock_waiter() - Remove the first data_vio from the lock's wait queue and return it. 416 + * dequeue_lock_waiter() - Remove the first data_vio from the lock's waitq and return it. 417 417 * @lock: The lock containing the wait queue. 418 418 * 419 419 * Return: The first (oldest) waiter in the queue, or NULL if the queue is empty. 420 420 */ 421 421 static inline struct data_vio *dequeue_lock_waiter(struct hash_lock *lock) 422 422 { 423 - return vdo_waiter_as_data_vio(vdo_waitq_dequeue_next_waiter(&lock->waiters)); 423 + return vdo_waiter_as_data_vio(vdo_waitq_dequeue_waiter(&lock->waiters)); 424 424 } 425 425 426 426 /**
+2 -2
drivers/md/dm-vdo/flush.c
··· 196 196 assert_on_flusher_thread(flusher, __func__); 197 197 198 198 vdo_waitq_enqueue_waiter(&flusher->pending_flushes, 199 - vdo_waitq_dequeue_next_waiter(&flusher->notifiers)); 199 + vdo_waitq_dequeue_waiter(&flusher->notifiers)); 200 200 vdo_complete_flushes(flusher); 201 201 if (vdo_waitq_has_waiters(&flusher->notifiers)) 202 202 notify_flush(flusher); ··· 335 335 "acknowledged next expected flush, %llu, was: %llu", 336 336 (unsigned long long) flusher->first_unacknowledged_generation, 337 337 (unsigned long long) flush->flush_generation); 338 - vdo_waitq_dequeue_next_waiter(&flusher->pending_flushes); 338 + vdo_waitq_dequeue_waiter(&flusher->pending_flushes); 339 339 vdo_complete_flush(flush); 340 340 flusher->first_unacknowledged_generation++; 341 341 }
+1 -1
drivers/md/dm-vdo/recovery-journal.c
··· 1332 1332 { 1333 1333 while (vdo_waitq_has_waiters(&block->entry_waiters)) { 1334 1334 struct data_vio *data_vio = 1335 - vdo_waiter_as_data_vio(vdo_waitq_dequeue_next_waiter(&block->entry_waiters)); 1335 + vdo_waiter_as_data_vio(vdo_waitq_dequeue_waiter(&block->entry_waiters)); 1336 1336 struct tree_lock *lock = &data_vio->tree_lock; 1337 1337 struct packed_recovery_journal_entry *packed_entry; 1338 1338 struct recovery_journal_entry new_entry;
+9 -9
drivers/md/dm-vdo/wait-queue.c
··· 135 135 vdo_waitq_transfer_all_waiters(waitq, &iteration_waitq); 136 136 137 137 while (vdo_waitq_has_waiters(&iteration_waitq)) { 138 - struct vdo_waiter *waiter = vdo_waitq_dequeue_next_waiter(&iteration_waitq); 138 + struct vdo_waiter *waiter = vdo_waitq_dequeue_waiter(&iteration_waitq); 139 139 140 140 vdo_waitq_enqueue_waiter((waiter_match(waiter, match_context) ? 141 141 matched_waitq : waitq), waiter); ··· 143 143 } 144 144 145 145 /** 146 - * vdo_waitq_dequeue_next_waiter() - Remove the first waiter from the head end of a waitq. 146 + * vdo_waitq_dequeue_waiter() - Remove the first (oldest) waiter from a waitq. 147 147 * @waitq: The vdo_wait_queue from which to remove the first entry. 148 148 * 149 - * The caller will be responsible for waking the waiter by invoking the correct callback function 150 - * to resume its execution. 149 + * The caller will be responsible for waking the waiter by continuing its 150 + * execution appropriately. 151 151 * 152 152 * Return: The first (oldest) waiter in the waitq, or NULL if the waitq is empty. 153 153 */ 154 - struct vdo_waiter *vdo_waitq_dequeue_next_waiter(struct vdo_wait_queue *waitq) 154 + struct vdo_waiter *vdo_waitq_dequeue_waiter(struct vdo_wait_queue *waitq) 155 155 { 156 156 struct vdo_waiter *first_waiter = vdo_waitq_get_first_waiter(waitq); 157 157 struct vdo_waiter *last_waiter = waitq->last_waiter; ··· 160 160 return NULL; 161 161 162 162 if (first_waiter == last_waiter) { 163 - /* The waitq has a single entry, so just empty it out by nulling the tail. */ 163 + /* The waitq has a single entry, so empty it by nulling the tail. */ 164 164 waitq->last_waiter = NULL; 165 165 } else { 166 166 /* 167 - * The waitq has more than one entry, so splice the first waiter out of the 168 - * circular waitq. 167 + * The waitq has multiple waiters, so splice the first waiter out 168 + * of the circular waitq. 169 169 */ 170 170 last_waiter->next_waiter = first_waiter->next_waiter; 171 171 } ··· 192 192 bool vdo_waitq_notify_next_waiter(struct vdo_wait_queue *waitq, 193 193 vdo_waiter_callback_fn callback, void *context) 194 194 { 195 - struct vdo_waiter *waiter = vdo_waitq_dequeue_next_waiter(waitq); 195 + struct vdo_waiter *waiter = vdo_waitq_dequeue_waiter(waitq); 196 196 197 197 if (waiter == NULL) 198 198 return false;
+2 -2
drivers/md/dm-vdo/wait-queue.h
··· 106 106 void vdo_waitq_enqueue_waiter(struct vdo_wait_queue *waitq, 107 107 struct vdo_waiter *waiter); 108 108 109 + struct vdo_waiter *vdo_waitq_dequeue_waiter(struct vdo_wait_queue *waitq); 110 + 109 111 void vdo_waitq_notify_all_waiters(struct vdo_wait_queue *waitq, 110 112 vdo_waiter_callback_fn callback, void *context); 111 113 ··· 123 121 vdo_waiter_match_fn waiter_match, 124 122 void *match_context, 125 123 struct vdo_wait_queue *matched_waitq); 126 - 127 - struct vdo_waiter *vdo_waitq_dequeue_next_waiter(struct vdo_wait_queue *waitq); 128 124 129 125 /** 130 126 * vdo_waitq_num_waiters() - Return the number of waiters in a vdo_wait_queue.