[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 04/13] virtio-blk: implement BlockDevOps->drain_thread
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [RFC 04/13] virtio-blk: implement BlockDevOps->drain_threads_cb() |
Date: |
Fri, 14 Jun 2013 11:48:24 +0200 |
Drain and stop the dataplane thread when bdrv_drain_all() is called.
Note that the thread will be restarted in virtio_blk_handle_output() the
next time the guest kicks the virtqueue.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/block/virtio-blk.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index cf12469..f9c2b79 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -618,8 +618,20 @@ static void virtio_blk_resize(void *opaque)
virtio_notify_config(vdev);
}
+static void virtio_blk_drain_threads(void *opaque)
+{
+#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
+ VirtIOBlock *s = VIRTIO_BLK(opaque);
+
+ if (s->dataplane) {
+ virtio_blk_data_plane_stop(s->dataplane);
+ }
+#endif
+}
+
static const BlockDevOps virtio_block_ops = {
.resize_cb = virtio_blk_resize,
+ .drain_threads_cb = virtio_blk_drain_threads,
};
void virtio_blk_set_conf(DeviceState *dev, VirtIOBlkConf *blk)
--
1.8.1.4
- [Qemu-devel] [RFC 00/13] dataplane: use block layer, Stefan Hajnoczi, 2013/06/14
- [Qemu-devel] [RFC 07/13] block: add thread_aio_context TLS variable, Stefan Hajnoczi, 2013/06/14
- [Qemu-devel] [RFC 09/13] main-loop: use thread-local AioContext, Stefan Hajnoczi, 2013/06/14
- [Qemu-devel] [RFC 10/13] block: disable I/O throttling outside main loop, Stefan Hajnoczi, 2013/06/14
- [Qemu-devel] [RFC 08/13] block: drop bdrv_get_aio_context(), Stefan Hajnoczi, 2013/06/14