summaryrefslogtreecommitdiff
path: root/block_int.h
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-20 18:25:59 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-20 18:25:59 +0000
commit6bbff9a0b495918309074ac60375be5f9dc868b3 (patch)
treed3d3a1d837396fbdadd74847ae6ba5503b985da2 /block_int.h
parent97b83deb557679c909465456acaa723c2ba34948 (diff)
Refactor aio callback allocation to use an aiocb pool (Avi Kivity)
Move the AIOCB allocation code to use a dedicate structure, AIOPool. AIOCB specific information, such as the AIOCB size and cancellation routine, is moved into the pool. At present, there is exactly one pool per block format driver, maintaining the status quo. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6870 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block_int.h')
-rw-r--r--block_int.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/block_int.h b/block_int.h
index d3c81facf7..8b4c5fe5fc 100644
--- a/block_int.h
+++ b/block_int.h
@@ -30,6 +30,12 @@
#define BLOCK_FLAG_COMPRESS 2
#define BLOCK_FLAG_COMPAT6 4
+typedef struct AIOPool {
+ void (*cancel)(BlockDriverAIOCB *acb);
+ int aiocb_size;
+ BlockDriverAIOCB *free_aiocb;
+} AIOPool;
+
struct BlockDriver {
const char *format_name;
int instance_size;
@@ -91,7 +97,7 @@ struct BlockDriver {
BlockDriverCompletionFunc *cb,
void *opaque);
- BlockDriverAIOCB *free_aiocb;
+ AIOPool aio_pool;
struct BlockDriver *next;
};
@@ -141,6 +147,7 @@ struct BlockDriverState {
};
struct BlockDriverAIOCB {
+ AIOPool *pool;
BlockDriverState *bs;
BlockDriverCompletionFunc *cb;
void *opaque;
@@ -149,8 +156,13 @@ struct BlockDriverAIOCB {
void get_tmp_filename(char *filename, int size);
+void aio_pool_init(AIOPool *pool, int aiocb_size,
+ void (*cancel)(BlockDriverAIOCB *acb));
+
void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb,
void *opaque);
+void *qemu_aio_get_pool(AIOPool *pool, BlockDriverState *bs,
+ BlockDriverCompletionFunc *cb, void *opaque);
void qemu_aio_release(void *p);
extern BlockDriverState *bdrv_first;