[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/32] vhost-user-fs: convert to the new virtio_delete_queue funct
From: |
Michael S. Tsirkin |
Subject: |
[PULL 06/32] vhost-user-fs: convert to the new virtio_delete_queue function |
Date: |
Tue, 25 Feb 2020 10:12:54 -0500 |
From: Pan Nengyuan <address@hidden>
use the new virtio_delete_queue function to cleanup.
Signed-off-by: Pan Nengyuan <address@hidden>
Cc: "Dr. David Alan Gilbert" <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/virtio/vhost-user-fs.h | 2 ++
hw/virtio/vhost-user-fs.c | 15 +++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/hw/virtio/vhost-user-fs.h
b/include/hw/virtio/vhost-user-fs.h
index 9ff1bdb7cf..6f3030d288 100644
--- a/include/hw/virtio/vhost-user-fs.h
+++ b/include/hw/virtio/vhost-user-fs.h
@@ -37,6 +37,8 @@ typedef struct {
struct vhost_virtqueue *vhost_vqs;
struct vhost_dev vhost_dev;
VhostUserState vhost_user;
+ VirtQueue **req_vqs;
+ VirtQueue *hiprio_vq;
/*< public >*/
} VHostUserFS;
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index 4554d123b7..6136768875 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -209,11 +209,12 @@ static void vuf_device_realize(DeviceState *dev, Error
**errp)
sizeof(struct virtio_fs_config));
/* Hiprio queue */
- virtio_add_queue(vdev, fs->conf.queue_size, vuf_handle_output);
+ fs->hiprio_vq = virtio_add_queue(vdev, fs->conf.queue_size,
vuf_handle_output);
/* Request queues */
+ fs->req_vqs = g_new(VirtQueue *, fs->conf.num_request_queues);
for (i = 0; i < fs->conf.num_request_queues; i++) {
- virtio_add_queue(vdev, fs->conf.queue_size, vuf_handle_output);
+ fs->req_vqs[i] = virtio_add_queue(vdev, fs->conf.queue_size,
vuf_handle_output);
}
/* 1 high prio queue, plus the number configured */
@@ -230,10 +231,11 @@ static void vuf_device_realize(DeviceState *dev, Error
**errp)
err_virtio:
vhost_user_cleanup(&fs->vhost_user);
- virtio_del_queue(vdev, 0);
+ virtio_delete_queue(fs->hiprio_vq);
for (i = 0; i < fs->conf.num_request_queues; i++) {
- virtio_del_queue(vdev, i + 1);
+ virtio_delete_queue(fs->req_vqs[i]);
}
+ g_free(fs->req_vqs);
virtio_cleanup(vdev);
g_free(fs->vhost_dev.vqs);
return;
@@ -252,10 +254,11 @@ static void vuf_device_unrealize(DeviceState *dev, Error
**errp)
vhost_user_cleanup(&fs->vhost_user);
- virtio_del_queue(vdev, 0);
+ virtio_delete_queue(fs->hiprio_vq);
for (i = 0; i < fs->conf.num_request_queues; i++) {
- virtio_del_queue(vdev, i + 1);
+ virtio_delete_queue(fs->req_vqs[i]);
}
+ g_free(fs->req_vqs);
virtio_cleanup(vdev);
g_free(fs->vhost_dev.vqs);
fs->vhost_dev.vqs = NULL;
--
MST
- [PULL 00/32] virtio, pc: fixes, features, Michael S. Tsirkin, 2020/02/25
- [PULL 01/32] bios-tables-test: tell people how to update, Michael S. Tsirkin, 2020/02/25
- [PULL 02/32] bios-tables-test: fix up DIFF generation, Michael S. Tsirkin, 2020/02/25
- [PULL 03/32] bios-tables-test: default diff command, Michael S. Tsirkin, 2020/02/25
- [PULL 04/32] rebuild-expected-aml.sh: remind about the process, Michael S. Tsirkin, 2020/02/25
- [PULL 05/32] vhost-user-fs: do delete virtio_queues in unrealize, Michael S. Tsirkin, 2020/02/25
- [PULL 06/32] vhost-user-fs: convert to the new virtio_delete_queue function,
Michael S. Tsirkin <=
- [PULL 07/32] virtio-pmem: do delete rq_vq in virtio_pmem_unrealize, Michael S. Tsirkin, 2020/02/25
- [PULL 08/32] virtio-crypto: do delete ctrl_vq in virtio_crypto_device_unrealize, Michael S. Tsirkin, 2020/02/25
- [PULL 09/32] vhost-user-blk: delete virtioqueues in unrealize to fix memleaks, Michael S. Tsirkin, 2020/02/25
- [PULL 10/32] vhost-user-blk: convert to new virtio_delete_queue, Michael S. Tsirkin, 2020/02/25
- [PULL 11/32] virtio: gracefully handle invalid region caches, Michael S. Tsirkin, 2020/02/25
- [PULL 13/32] virtio-iommu: Decode the command payload, Michael S. Tsirkin, 2020/02/25
- [PULL 12/32] virtio-iommu: Add skeleton, Michael S. Tsirkin, 2020/02/25
- [PULL 15/32] virtio-iommu: Implement map/unmap, Michael S. Tsirkin, 2020/02/25
- [PULL 16/32] virtio-iommu: Implement translate, Michael S. Tsirkin, 2020/02/25
- [PULL 17/32] virtio-iommu: Implement fault reporting, Michael S. Tsirkin, 2020/02/25