Commit e752e5c3 authored by Mike Snitzer's avatar Mike Snitzer

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: default avatarKen Raeburn <raeburn@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent cd1227dd
......@@ -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);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment