|
|
9ae3a8 |
From f9630bb1a1267c9d3f8b2d3e70bfa9a05bd0cf07 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 23 Jan 2014 14:03:34 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 07/14] virtio-blk: switch exit callback to VirtioDeviceClass
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1390485820-7585-5-git-send-email-armbru@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56922
|
|
|
9ae3a8 |
O-Subject: [PATCH 7.0 qemu-kvm 04/10] virtio-blk: switch exit callback to VirtioDeviceClass
|
|
|
9ae3a8 |
Bugzilla: 983344
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This ensures hot-unplug is handled properly by the proxy, and avoids
|
|
|
9ae3a8 |
leaking bus_name which is freed by virtio_device_exit.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Acked-by: Andreas Faerber <afaerber@suse.de>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 40dfc16f5fe0afb66f9436718781264dfadb6c61)
|
|
|
9ae3a8 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/block/virtio-blk.c | 10 ++++------
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/block/virtio-blk.c | 10 ++++------
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
|
|
|
9ae3a8 |
index 49a23c3..aa37cc9 100644
|
|
|
9ae3a8 |
--- a/hw/block/virtio-blk.c
|
|
|
9ae3a8 |
+++ b/hw/block/virtio-blk.c
|
|
|
9ae3a8 |
@@ -729,20 +729,18 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int virtio_blk_device_exit(DeviceState *dev)
|
|
|
9ae3a8 |
+static void virtio_blk_device_exit(VirtIODevice *vdev)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
|
|
9ae3a8 |
- VirtIOBlock *s = VIRTIO_BLK(dev);
|
|
|
9ae3a8 |
+ VirtIOBlock *s = VIRTIO_BLK(vdev);
|
|
|
9ae3a8 |
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
|
|
|
9ae3a8 |
remove_migration_state_change_notifier(&s->migration_state_notifier);
|
|
|
9ae3a8 |
virtio_blk_data_plane_destroy(s->dataplane);
|
|
|
9ae3a8 |
s->dataplane = NULL;
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
qemu_del_vm_change_state_handler(s->change);
|
|
|
9ae3a8 |
- unregister_savevm(dev, "virtio-blk", s);
|
|
|
9ae3a8 |
+ unregister_savevm(DEVICE(vdev), "virtio-blk", s);
|
|
|
9ae3a8 |
blockdev_mark_auto_del(s->bs);
|
|
|
9ae3a8 |
virtio_cleanup(vdev);
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static Property virtio_blk_properties[] = {
|
|
|
9ae3a8 |
@@ -754,10 +752,10 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
- dc->exit = virtio_blk_device_exit;
|
|
|
9ae3a8 |
dc->props = virtio_blk_properties;
|
|
|
9ae3a8 |
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
|
|
9ae3a8 |
vdc->init = virtio_blk_device_init;
|
|
|
9ae3a8 |
+ vdc->exit = virtio_blk_device_exit;
|
|
|
9ae3a8 |
vdc->get_config = virtio_blk_update_config;
|
|
|
9ae3a8 |
vdc->set_config = virtio_blk_set_config;
|
|
|
9ae3a8 |
vdc->get_features = virtio_blk_get_features;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|