This patch renames vhost_work_dev_flush to just vhost_dev_flush to relfect that it flushes everything on the device and that drivers don't know/care that polls are based on vhost_works. Drivers just flush the entire device and polls, and works for vhost-scsi management TMFs and IO net virtqueues, etc all are flushed.
Unified · Split
| @@ -1376,7 +1376,7 @@ static void vhost_net_stop(struct vhost_net *n, struct socket **tx_sock, · 1375 unmodified lines | |||
| 1376 | 1376 | ||
| 1377 | static void vhost_net_flush(struct vhost_net *n) | 1377 | static void vhost_net_flush(struct vhost_net *n) |
| 1378 | { | 1378 | { |
| 1379 | vhost_work_dev_flush(&n->dev); | 1379 | vhost_dev_flush(&n->dev); |
| 1380 | if (n->vqs[VHOST_NET_VQ_TX].ubufs) { | 1380 | if (n->vqs[VHOST_NET_VQ_TX].ubufs) { |
| 1381 | mutex_lock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex); | 1381 | mutex_lock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex); |
| 1382 | n->tx_flush = true; | 1382 | n->tx_flush = true; |
| @@ -1565,7 +1565,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) · 182 unmodified lines | |||
| 1565 | } | 1565 | } |
| 1566 | 1566 | ||
| 1567 | if (oldsock) { | 1567 | if (oldsock) { |
| 1568 | vhost_work_dev_flush(&n->dev); | 1568 | vhost_dev_flush(&n->dev); |
| 1569 | sockfd_put(oldsock); | 1569 | sockfd_put(oldsock); |
| 1570 | } | 1570 | } |
| 1571 | 1571 | ||
| @@ -1436,7 +1436,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) · 1435 unmodified lines | |||
| 1436 | kref_put(&old_inflight[i]->kref, vhost_scsi_done_inflight); | 1436 | kref_put(&old_inflight[i]->kref, vhost_scsi_done_inflight); |
| 1437 | 1437 | ||
| 1438 | /* Flush both the vhost poll and vhost work */ | 1438 | /* Flush both the vhost poll and vhost work */ |
| 1439 | vhost_work_dev_flush(&vs->dev); | 1439 | vhost_dev_flush(&vs->dev); |
| 1440 | 1440 | ||
| 1441 | /* Wait for all reqs issued before the flush to be finished */ | 1441 | /* Wait for all reqs issued before the flush to be finished */ |
| 1442 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | 1442 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) |
| @@ -146,7 +146,7 @@ static void vhost_test_stop(struct vhost_test *n, void **privatep) · 145 unmodified lines | |||
| 146 | 146 | ||
| 147 | static void vhost_test_flush(struct vhost_test *n) | 147 | static void vhost_test_flush(struct vhost_test *n) |
| 148 | { | 148 | { |
| 149 | vhost_work_dev_flush(&n->dev); | 149 | vhost_dev_flush(&n->dev); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static int vhost_test_release(struct inode *inode, struct file *f) | 152 | static int vhost_test_release(struct inode *inode, struct file *f) |
| @@ -231,7 +231,7 @@ void vhost_poll_stop(struct vhost_poll *poll) · 230 unmodified lines | |||
| 231 | } | 231 | } |
| 232 | EXPORT_SYMBOL_GPL(vhost_poll_stop); | 232 | EXPORT_SYMBOL_GPL(vhost_poll_stop); |
| 233 | 233 | ||
| 234 | void vhost_work_dev_flush(struct vhost_dev *dev) | 234 | void vhost_dev_flush(struct vhost_dev *dev) |
| 235 | { | 235 | { |
| 236 | struct vhost_flush_struct flush; | 236 | struct vhost_flush_struct flush; |
| 237 | 237 | ||
| @@ -243,7 +243,7 @@ void vhost_work_dev_flush(struct vhost_dev *dev) · 5 unmodified lines | |||
| 243 | wait_for_completion(&flush.wait_event); | 243 | wait_for_completion(&flush.wait_event); |
| 244 | } | 244 | } |
| 245 | } | 245 | } |
| 246 | EXPORT_SYMBOL_GPL(vhost_work_dev_flush); | 246 | EXPORT_SYMBOL_GPL(vhost_dev_flush); |
| 247 | 247 | ||
| 248 | void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) | 248 | void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) |
| 249 | { | 249 | { |
| @@ -530,7 +530,7 @@ static int vhost_attach_cgroups(struct vhost_dev *dev) · 280 unmodified lines | |||
| 530 | attach.owner = current; | 530 | attach.owner = current; |
| 531 | vhost_work_init(&attach.work, vhost_attach_cgroups_work); | 531 | vhost_work_init(&attach.work, vhost_attach_cgroups_work); |
| 532 | vhost_work_queue(dev, &attach.work); | 532 | vhost_work_queue(dev, &attach.work); |
| 533 | vhost_work_dev_flush(dev); | 533 | vhost_dev_flush(dev); |
| 534 | return attach.ret; | 534 | return attach.ret; |
| 535 | } | 535 | } |
| 536 | 536 | ||
| @@ -657,7 +657,7 @@ void vhost_dev_stop(struct vhost_dev *dev) · 120 unmodified lines | |||
| 657 | vhost_poll_stop(&dev->vqs[i]->poll); | 657 | vhost_poll_stop(&dev->vqs[i]->poll); |
| 658 | } | 658 | } |
| 659 | 659 | ||
| 660 | vhost_work_dev_flush(dev); | 660 | vhost_dev_flush(dev); |
| 661 | } | 661 | } |
| 662 | EXPORT_SYMBOL_GPL(vhost_dev_stop); | 662 | EXPORT_SYMBOL_GPL(vhost_dev_stop); |
| 663 | 663 | ||
| @@ -1724,7 +1724,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *arg · 1060 unmodified lines | |||
| 1724 | mutex_unlock(&vq->mutex); | 1724 | mutex_unlock(&vq->mutex); |
| 1725 | 1725 | ||
| 1726 | if (pollstop && vq->handle_kick) | 1726 | if (pollstop && vq->handle_kick) |
| 1727 | vhost_work_dev_flush(vq->poll.dev); | 1727 | vhost_dev_flush(vq->poll.dev); |
| 1728 | return r; | 1728 | return r; |
| 1729 | } | 1729 | } |
| 1730 | EXPORT_SYMBOL_GPL(vhost_vring_ioctl); | 1730 | EXPORT_SYMBOL_GPL(vhost_vring_ioctl); |
| @@ -45,7 +45,7 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, · 44 unmodified lines | |||
| 45 | int vhost_poll_start(struct vhost_poll *poll, struct file *file); | 45 | int vhost_poll_start(struct vhost_poll *poll, struct file *file); |
| 46 | void vhost_poll_stop(struct vhost_poll *poll); | 46 | void vhost_poll_stop(struct vhost_poll *poll); |
| 47 | void vhost_poll_queue(struct vhost_poll *poll); | 47 | void vhost_poll_queue(struct vhost_poll *poll); |
| 48 | void vhost_work_dev_flush(struct vhost_dev *dev); | 48 | void vhost_dev_flush(struct vhost_dev *dev); |
| 49 | 49 | ||
| 50 | struct vhost_log { | 50 | struct vhost_log { |
| 51 | u64 addr; | 51 | u64 addr; |
| @@ -705,7 +705,7 @@ out: · 704 unmodified lines | |||
| 705 | 705 | ||
| 706 | static void vhost_vsock_flush(struct vhost_vsock *vsock) | 706 | static void vhost_vsock_flush(struct vhost_vsock *vsock) |
| 707 | { | 707 | { |
| 708 | vhost_work_dev_flush(&vsock->dev); | 708 | vhost_dev_flush(&vsock->dev); |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | static void vhost_vsock_reset_orphans(struct sock *sk) | 711 | static void vhost_vsock_reset_orphans(struct sock *sk) |