summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-11-20 17:29:18 -0500
committerMike Snitzer <snitzer@kernel.org>2024-02-20 13:43:16 -0500
commite752e5c33b960085f1ae12e391b18dd8fc5ceef1 (patch)
tree48ed75d80c68be5832e2e9a6252d12560f74147c /drivers/md
parentcd1227dd8341dca720ec71ad7dd2824fbf60ed4e (diff)
downloadlinux-stable-e752e5c33b960085f1ae12e391b18dd8fc5ceef1.tar.gz
linux-stable-e752e5c33b960085f1ae12e391b18dd8fc5ceef1.tar.bz2
linux-stable-e752e5c33b960085f1ae12e391b18dd8fc5ceef1.zip
dm vdo wait-queue: optimize vdo_waitq_dequeue_matching_waiters
Remove temporary 'matched_waiters' waitq and just enqueue matched waiters directly to the caller provided 'matched_waitq'. 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/wait-queue.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/md/dm-vdo/wait-queue.c b/drivers/md/dm-vdo/wait-queue.c
index 4231d3243fa1..7e4cf9f03249 100644
--- a/drivers/md/dm-vdo/wait-queue.c
+++ b/drivers/md/dm-vdo/wait-queue.c
@@ -129,10 +129,8 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,
void *match_context,
struct vdo_wait_queue *matched_waitq)
{
- // FIXME: copying a waitq just to iterate it, with matching, is unfortunate
- struct vdo_wait_queue matched_waiters, iteration_waitq;
+ struct vdo_wait_queue iteration_waitq;
- vdo_waitq_init(&matched_waiters);
vdo_waitq_init(&iteration_waitq);
vdo_waitq_transfer_all_waiters(waitq, &iteration_waitq);
@@ -140,10 +138,8 @@ void vdo_waitq_dequeue_matching_waiters(struct vdo_wait_queue *waitq,
struct vdo_waiter *waiter = vdo_waitq_dequeue_next_waiter(&iteration_waitq);
vdo_waitq_enqueue_waiter((waiter_match(waiter, match_context) ?
- &matched_waiters : waitq), waiter);
+ matched_waitq : waitq), waiter);
}
-
- vdo_waitq_transfer_all_waiters(&matched_waiters, matched_waitq);
}
/**