[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3 of 12] backport c07a9008ac6985cd5a15909c2b9977d982defc12



Backport c07a9008ac6985cd5a15909c2b9977d982defc12 from qemu upstream:

Convert vectored aio emulation to use a dedicated pool (Avi Kivity)

---

diff -r 5a32ceb2bb1a block.c
--- a/block.c   Fri Oct 02 13:38:11 2009 +0100
+++ b/block.c   Fri Oct 02 13:38:28 2009 +0100
@@ -40,6 +40,8 @@
 
 #define SECTOR_BITS 9
 #define SECTOR_SIZE (1 << SECTOR_BITS)
+
+static AIOPool vectored_aio_pool;
 
 typedef struct BlockDriverAIOCBSync {
     BlockDriverAIOCB common;
@@ -1369,6 +1371,13 @@
     BlockDriverAIOCB *this_aiocb;
 } VectorTranslationState;
 
+static void bdrv_aio_cancel_vector(BlockDriverAIOCB *acb)
+{
+    VectorTranslationState *s = acb->opaque;
+
+    bdrv_aio_cancel(s->aiocb);
+}
+
 static void bdrv_aio_rw_vector_cb(void *opaque, int ret)
 {
     VectorTranslationState *s = opaque;
@@ -1391,7 +1400,8 @@
 
 {
     VectorTranslationState *s = qemu_mallocz(sizeof(*s));
-    BlockDriverAIOCB *aiocb = qemu_aio_get(bs, cb, opaque);
+    BlockDriverAIOCB *aiocb = qemu_aio_get_pool(&vectored_aio_pool, bs,
+                                                cb, opaque);
 
     s->this_aiocb = aiocb;
     s->iov = iov;
@@ -1480,11 +1490,6 @@
 
 void bdrv_aio_cancel(BlockDriverAIOCB *acb)
 {
-    if (acb->cb == bdrv_aio_rw_vector_cb) {
-        VectorTranslationState *s = acb->opaque;
-        acb = s->aiocb;
-    }
-
     acb->pool->cancel(acb);
 }
 
@@ -1611,6 +1616,9 @@
 
 void bdrv_init(void)
 {
+    aio_pool_init(&vectored_aio_pool, sizeof(BlockDriverAIOCB),
+                  bdrv_aio_cancel_vector);
+
     bdrv_register(&bdrv_raw);
 #ifndef CONFIG_STUBDOM
     bdrv_register(&bdrv_host_device);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.