History

vhost: rename vhost_work_dev_flush

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.

Mike Christie committed 4 years ago

Commit b2ffa401 parent f3a1aad6 files · +11 −11Browse files

Unified · Split

6 files
  1. drivers/vhost/net.c +2 −2
  2. drivers/vhost/scsi.c +1 −1
  3. drivers/vhost/test.c +1 −1
  4. drivers/vhost/vhost.c +5 −5
  5. drivers/vhost/vhost.h +1 −1
  6. drivers/vhost/vsock.c +1 −1
drivers/vhost/net.c+2−2
@@ -1376,7 +1376,7 @@ static void vhost_net_stop(struct vhost_net *n, struct socket **tx_sock, · 1375 unmodified lines
1376 1376
1377static void vhost_net_flush(struct vhost_net *n)1377static 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
drivers/vhost/scsi.c+1−1
@@ -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++)
drivers/vhost/test.c+1−1
@@ -146,7 +146,7 @@ static void vhost_test_stop(struct vhost_test *n, void **privatep) · 145 unmodified lines
146 146
147static void vhost_test_flush(struct vhost_test *n)147static 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
152static int vhost_test_release(struct inode *inode, struct file *f)152static int vhost_test_release(struct inode *inode, struct file *f)
drivers/vhost/vhost.c+5−5
@@ -231,7 +231,7 @@ void vhost_poll_stop(struct vhost_poll *poll) · 230 unmodified lines
231}231}
232EXPORT_SYMBOL_GPL(vhost_poll_stop);232EXPORT_SYMBOL_GPL(vhost_poll_stop);
233 233
234void vhost_work_dev_flush(struct vhost_dev *dev)234void 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}
246EXPORT_SYMBOL_GPL(vhost_work_dev_flush);246EXPORT_SYMBOL_GPL(vhost_dev_flush);
247 247
248void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)248void 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}
662EXPORT_SYMBOL_GPL(vhost_dev_stop);662EXPORT_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}
1730EXPORT_SYMBOL_GPL(vhost_vring_ioctl);1730EXPORT_SYMBOL_GPL(vhost_vring_ioctl);
drivers/vhost/vhost.h+1−1
@@ -45,7 +45,7 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, · 44 unmodified lines
45int vhost_poll_start(struct vhost_poll *poll, struct file *file);45int vhost_poll_start(struct vhost_poll *poll, struct file *file);
46void vhost_poll_stop(struct vhost_poll *poll);46void vhost_poll_stop(struct vhost_poll *poll);
47void vhost_poll_queue(struct vhost_poll *poll);47void vhost_poll_queue(struct vhost_poll *poll);
48void vhost_work_dev_flush(struct vhost_dev *dev);48void vhost_dev_flush(struct vhost_dev *dev);
49 49
50struct vhost_log {50struct vhost_log {
51 u64 addr;51 u64 addr;
drivers/vhost/vsock.c+1−1
@@ -705,7 +705,7 @@ out: · 704 unmodified lines
705 705
706static void vhost_vsock_flush(struct vhost_vsock *vsock)706static 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
711static void vhost_vsock_reset_orphans(struct sock *sk)711static void vhost_vsock_reset_orphans(struct sock *sk)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t