render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame qemu-v2-block-avoid-creating-too-large-iovecs-in-multiwrite_merge.patch

Justin M. Forbes 563054
If we go over the maximum number of iovecs support by syscall we get
Justin M. Forbes 563054
back EINVAL from the kernel which translate to I/O errors for the guest.
Justin M. Forbes 563054
Justin M. Forbes 563054
Add a MAX_IOV defintion for platforms that don't have it.  For now we use
Justin M. Forbes 563054
the same 1024 define that's used on Linux and various other platforms,
Justin M. Forbes 563054
but until the windows block backend implements some kind of vectored I/O
Justin M. Forbes 563054
it doesn't matter.
Justin M. Forbes 563054
Justin M. Forbes 563054
Signed-off-by: Christoph Hellwig <hch@lst.de>
Justin M. Forbes 563054
Justin M. Forbes 563054
Index: qemu/block.c
Justin M. Forbes 563054
===================================================================
Justin M. Forbes 563054
--- qemu.orig/block.c	2010-01-26 10:59:39.757004445 +0100
Justin M. Forbes 563054
+++ qemu/block.c	2010-01-26 11:01:38.056023231 +0100
Justin M. Forbes 563054
@@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverS
Justin M. Forbes 563054
             merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]);
Justin M. Forbes 563054
         }
Justin M. Forbes 563054
 
Justin M. Forbes 563054
+        if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) {
Justin M. Forbes 563054
+            merge = 0;
Justin M. Forbes 563054
+        }
Justin M. Forbes 563054
+
Justin M. Forbes 563054
         if (merge) {
Justin M. Forbes 563054
             size_t size;
Justin M. Forbes 563054
             QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
Justin M. Forbes 563054
Index: qemu/qemu-common.h
Justin M. Forbes 563054
===================================================================
Justin M. Forbes 563054
--- qemu.orig/qemu-common.h	2010-01-26 14:41:40.894254285 +0100
Justin M. Forbes 563054
+++ qemu/qemu-common.h	2010-01-26 14:42:27.267275698 +0100
Justin M. Forbes 563054
@@ -54,6 +54,10 @@ struct iovec {
Justin M. Forbes 563054
     void *iov_base;
Justin M. Forbes 563054
     size_t iov_len;
Justin M. Forbes 563054
 };
Justin M. Forbes 563054
+/*
Justin M. Forbes 563054
+ * Use the same value as Linux for now.
Justin M. Forbes 563054
+ */
Justin M. Forbes 563054
+#define IOV_MAX		1024
Justin M. Forbes 563054
 #else
Justin M. Forbes 563054
 #include <sys/uio.h>
Justin M. Forbes 563054
 #endif
Justin M. Forbes 563054