diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-14 20:41:47 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-14 20:41:47 (GMT) |
commit | b7e2041e2a184e3221970eaacf56724369e56bd9 (patch) | |
tree | 005c996c0f96951818d72e380c8c5fc716b48f07 | |
parent | 92d76e81b9df5f33b0c9e2091e892560a437a15f (diff) | |
parent | 0174b0c30a9de25dcb0d3049defcfad0c2947a36 (diff) | |
download | linux-b7e2041e2a184e3221970eaacf56724369e56bd9.tar.xz |
Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
-rw-r--r-- | drivers/vhost/vhost.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 38244f5..ade0568 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -97,22 +97,26 @@ void vhost_poll_stop(struct vhost_poll *poll) remove_wait_queue(poll->wqh, &poll->wait); } +static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, + unsigned seq) +{ + int left; + spin_lock_irq(&dev->work_lock); + left = seq - work->done_seq; + spin_unlock_irq(&dev->work_lock); + return left <= 0; +} + static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) { unsigned seq; - int left; int flushing; spin_lock_irq(&dev->work_lock); seq = work->queue_seq; work->flushing++; spin_unlock_irq(&dev->work_lock); - wait_event(work->done, ({ - spin_lock_irq(&dev->work_lock); - left = seq - work->done_seq <= 0; - spin_unlock_irq(&dev->work_lock); - left; - })); + wait_event(work->done, vhost_work_seq_done(dev, work, seq)); spin_lock_irq(&dev->work_lock); flushing = --work->flushing; spin_unlock_irq(&dev->work_lock); |