diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-22 20:20:00 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-22 20:20:00 +0000 |
commit | e268ca52328eb0460ae0d10b7f4313a63d5b000c (patch) | |
tree | 27a36b418653496829c54f59b31e9a2ad347b2e8 /block-qcow2.c | |
parent | 94909d9fd931367a3d5fabfb7bf5439eb05568e9 (diff) | |
download | qemu-e268ca52328eb0460ae0d10b7f4313a63d5b000c.zip qemu-e268ca52328eb0460ae0d10b7f4313a63d5b000c.tar.gz qemu-e268ca52328eb0460ae0d10b7f4313a63d5b000c.tar.bz2 |
implement qemu_blockalign (Stefano Stabellini)
this patch adds a buffer_alignment field to BlockDriverState and
implements a qemu_blockalign function that uses that field to allocate a
memory aligned buffer to be used by the block driver.
buffer_alignment is initialized to 512 but each block driver can set
a different value (at the moment none of them do).
This patch modifies ide.c, block-qcow.c, block-qcow2.c and block.c to
use qemu_blockalign instead of qemu_memalign.
There is only one place left that still uses qemu_memalign to allocate
buffers used by block drivers that is posix-aio-compat:handle_aiocb_rw
because it is not possible to get the BlockDriverState from that
function. However I think it is not important because posix-aio-compat
already deals with driver specific code so it is supposed to know its
own needs.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7229 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-qcow2.c')
-rw-r--r-- | block-qcow2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block-qcow2.c b/block-qcow2.c index 7840634..1f33125 100644 --- a/block-qcow2.c +++ b/block-qcow2.c @@ -1412,7 +1412,7 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs, acb->sector_num = sector_num; acb->qiov = qiov; if (qiov->niov > 1) { - acb->buf = acb->orig_buf = qemu_memalign(512, qiov->size); + acb->buf = acb->orig_buf = qemu_blockalign(bs, qiov->size); if (is_write) qemu_iovec_to_buffer(qiov, acb->buf); } else { |