diff options
Diffstat (limited to 'block-qcow.c')
-rw-r--r-- | block-qcow.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/block-qcow.c b/block-qcow.c index 1fabc494dd..2decd13e76 100644 --- a/block-qcow.c +++ b/block-qcow.c @@ -530,6 +530,8 @@ typedef struct QCowAIOCB { int n; uint64_t cluster_offset; uint8_t *cluster_data; + struct iovec hd_iov; + QEMUIOVector hd_qiov; BlockDriverAIOCB *hd_aiocb; } QCowAIOCB; @@ -584,8 +586,11 @@ static void qcow_aio_read_cb(void *opaque, int ret) if (!acb->cluster_offset) { if (bs->backing_hd) { /* read from the base image */ - acb->hd_aiocb = bdrv_aio_read(bs->backing_hd, - acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb); + acb->hd_iov.iov_base = acb->buf; + acb->hd_iov.iov_len = acb->n * 512; + qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); + acb->hd_aiocb = bdrv_aio_readv(bs->backing_hd, acb->sector_num, + &acb->hd_qiov, acb->n, qcow_aio_read_cb, acb); if (acb->hd_aiocb == NULL) goto fail; } else { @@ -605,9 +610,12 @@ static void qcow_aio_read_cb(void *opaque, int ret) ret = -EIO; goto fail; } - acb->hd_aiocb = bdrv_aio_read(s->hd, + acb->hd_iov.iov_base = acb->buf; + acb->hd_iov.iov_len = acb->n * 512; + qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); + acb->hd_aiocb = bdrv_aio_readv(s->hd, (acb->cluster_offset >> 9) + index_in_cluster, - acb->buf, acb->n, qcow_aio_read_cb, acb); + &acb->hd_qiov, acb->n, qcow_aio_read_cb, acb); if (acb->hd_aiocb == NULL) goto fail; } @@ -687,10 +695,14 @@ static void qcow_aio_write_cb(void *opaque, int ret) } else { src_buf = acb->buf; } - acb->hd_aiocb = bdrv_aio_write(s->hd, - (cluster_offset >> 9) + index_in_cluster, - src_buf, acb->n, - qcow_aio_write_cb, acb); + + acb->hd_iov.iov_base = (void *)src_buf; + acb->hd_iov.iov_len = acb->n * 512; + qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); + acb->hd_aiocb = bdrv_aio_writev(s->hd, + (cluster_offset >> 9) + index_in_cluster, + &acb->hd_qiov, acb->n, + qcow_aio_write_cb, acb); if (acb->hd_aiocb == NULL) goto fail; } |