I guess the main block code is not as defensive as I thought it was. This patch
uses qemu_memalign to allocate the buffers for IO so that you don't get errors
when using O_DIRECT.
It applies on top of my previous patch to introduce copies in virtio-blk.
Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>
diff --git a/qemu/hw/virtio-blk.c b/qemu/hw/virtio-blk.c
index 2ea5669..669e55f 100644
--- a/qemu/hw/virtio-blk.c
+++ b/qemu/hw/virtio-blk.c
@@ -174,7 +174,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev,
VirtQueue *vq)
for (i = 1; i < req->elem.out_num; i++)
req->size += req->elem.out_sg[i].iov_len;
- req->buffer = qemu_malloc(req->size);
+ req->buffer = qemu_memalign(512, req->size);
if (req->buffer == NULL) {
qemu_free(req);
break;
@@ -203,7 +203,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev,
VirtQueue *vq)
for (i = 0; i < req->elem.in_num - 1; i++)
req->size += req->elem.in_sg[i].iov_len;
- req->buffer = qemu_malloc(req->size);
+ req->buffer = qemu_memalign(512, req->size);
if (req->buffer == NULL) {
qemu_free(req);
break;
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html