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-qcow.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-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 1fabc494d..2decd13e7 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; } |