Revision c07a9008

b/block.c
47 47
#define SECTOR_BITS 9
48 48
#define SECTOR_SIZE (1 << SECTOR_BITS)
49 49

  
50
static AIOPool vectored_aio_pool;
51

  
50 52
typedef struct BlockDriverAIOCBSync {
51 53
    BlockDriverAIOCB common;
52 54
    QEMUBH *bh;
......
1261 1263
    BlockDriverAIOCB *this_aiocb;
1262 1264
} VectorTranslationState;
1263 1265

  
1266
static void bdrv_aio_cancel_vector(BlockDriverAIOCB *acb)
1267
{
1268
    VectorTranslationState *s = acb->opaque;
1269

  
1270
    bdrv_aio_cancel(s->aiocb);
1271
}
1272

  
1264 1273
static void bdrv_aio_rw_vector_cb(void *opaque, int ret)
1265 1274
{
1266 1275
    VectorTranslationState *s = opaque;
......
1283 1292

  
1284 1293
{
1285 1294
    VectorTranslationState *s = qemu_mallocz(sizeof(*s));
1286
    BlockDriverAIOCB *aiocb = qemu_aio_get(bs, cb, opaque);
1295
    BlockDriverAIOCB *aiocb = qemu_aio_get_pool(&vectored_aio_pool, bs,
1296
                                                cb, opaque);
1287 1297

  
1288 1298
    s->this_aiocb = aiocb;
1289 1299
    s->iov = iov;
......
1372 1382

  
1373 1383
void bdrv_aio_cancel(BlockDriverAIOCB *acb)
1374 1384
{
1375
    if (acb->cb == bdrv_aio_rw_vector_cb) {
1376
        VectorTranslationState *s = acb->opaque;
1377
        acb = s->aiocb;
1378
    }
1379

  
1380 1385
    acb->pool->cancel(acb);
1381 1386
}
1382 1387

  
......
1478 1483

  
1479 1484
void bdrv_init(void)
1480 1485
{
1486
    aio_pool_init(&vectored_aio_pool, sizeof(BlockDriverAIOCB),
1487
                  bdrv_aio_cancel_vector);
1488

  
1481 1489
    bdrv_register(&bdrv_raw);
1482 1490
    bdrv_register(&bdrv_host_device);
1483 1491
#ifndef _WIN32

Also available in: Unified diff