diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-07 18:43:20 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-07 18:43:20 +0000 |
commit | c87c0672936a5b825c0b95bb1d7f5d6dc92294e4 (patch) | |
tree | cd09068e0b107d8ce738868752b613a65d2d229f /block-qcow2.c | |
parent | f1b2f712a4f059734b8eaebc0e523061387aeb26 (diff) |
remove bdrv_aio_read/bdrv_aio_write (Christoph Hellwig)
Always use the vectored APIs to reduce code churn once we switch the BlockDriver
API to be vectored.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7019 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-qcow2.c')
-rw-r--r-- | block-qcow2.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/block-qcow2.c b/block-qcow2.c index 6eba524a2..dd28c28e5 100644 --- a/block-qcow2.c +++ b/block-qcow2.c @@ -1270,6 +1270,8 @@ typedef struct QCowAIOCB { uint64_t cluster_offset; uint8_t *cluster_data; BlockDriverAIOCB *hd_aiocb; + struct iovec hd_iov; + QEMUIOVector hd_qiov; QEMUBH *bh; QCowL2Meta l2meta; } QCowAIOCB; @@ -1347,8 +1349,12 @@ fail: n1 = backing_read1(bs->backing_hd, acb->sector_num, acb->buf, acb->n); if (n1 > 0) { - 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 { @@ -1377,9 +1383,13 @@ fail: 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; } @@ -1476,10 +1486,13 @@ static void qcow_aio_write_cb(void *opaque, int ret) } else { src_buf = acb->buf; } - acb->hd_aiocb = bdrv_aio_write(s->hd, - (acb->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, + (acb->cluster_offset >> 9) + index_in_cluster, + &acb->hd_qiov, acb->n, + qcow_aio_write_cb, acb); if (acb->hd_aiocb == NULL) goto fail; } |