* [Qemu-devel] [PATCH v2] block: avoid creating too large iovecs in multiwrite_merge
@ 2010-01-26 13:49 Christoph Hellwig
2010-01-27 0:07 ` Anthony Liguori
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2010-01-26 13:49 UTC (permalink / raw)
To: qemu-devel
If we go over the maximum number of iovecs support by syscall we get
back EINVAL from the kernel which translate to I/O errors for the guest.
Add a MAX_IOV defintion for platforms that don't have it. For now we use
the same 1024 define that's used on Linux and various other platforms,
but until the windows block backend implements some kind of vectored I/O
it doesn't matter.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu/block.c
===================================================================
--- qemu.orig/block.c 2010-01-26 10:59:39.757004445 +0100
+++ qemu/block.c 2010-01-26 11:01:38.056023231 +0100
@@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverS
merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]);
}
+ if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) {
+ merge = 0;
+ }
+
if (merge) {
size_t size;
QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
Index: qemu/qemu-common.h
===================================================================
--- qemu.orig/qemu-common.h 2010-01-26 14:41:40.894254285 +0100
+++ qemu/qemu-common.h 2010-01-26 14:42:27.267275698 +0100
@@ -54,6 +54,10 @@ struct iovec {
void *iov_base;
size_t iov_len;
};
+/*
+ * Use the same value as Linux for now.
+ */
+#define IOV_MAX 1024
#else
#include <sys/uio.h>
#endif
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] block: avoid creating too large iovecs in multiwrite_merge
2010-01-26 13:49 [Qemu-devel] [PATCH v2] block: avoid creating too large iovecs in multiwrite_merge Christoph Hellwig
@ 2010-01-27 0:07 ` Anthony Liguori
2010-02-01 8:28 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2010-01-27 0:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: qemu-devel
On 01/26/2010 07:49 AM, Christoph Hellwig wrote:
> If we go over the maximum number of iovecs support by syscall we get
> back EINVAL from the kernel which translate to I/O errors for the guest.
>
> Add a MAX_IOV defintion for platforms that don't have it. For now we use
> the same 1024 define that's used on Linux and various other platforms,
> but until the windows block backend implements some kind of vectored I/O
> it doesn't matter.
>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
>
Applied. Thanks.
Regards,
Anthony Liguori
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c 2010-01-26 10:59:39.757004445 +0100
> +++ qemu/block.c 2010-01-26 11:01:38.056023231 +0100
> @@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverS
> merge = bs->drv->bdrv_merge_requests(bs,&reqs[outidx],&reqs[i]);
> }
>
> + if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1> IOV_MAX) {
> + merge = 0;
> + }
> +
> if (merge) {
> size_t size;
> QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
> Index: qemu/qemu-common.h
> ===================================================================
> --- qemu.orig/qemu-common.h 2010-01-26 14:41:40.894254285 +0100
> +++ qemu/qemu-common.h 2010-01-26 14:42:27.267275698 +0100
> @@ -54,6 +54,10 @@ struct iovec {
> void *iov_base;
> size_t iov_len;
> };
> +/*
> + * Use the same value as Linux for now.
> + */
> +#define IOV_MAX 1024
> #else
> #include<sys/uio.h>
> #endif
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] block: avoid creating too large iovecs in multiwrite_merge
2010-01-27 0:07 ` Anthony Liguori
@ 2010-02-01 8:28 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2010-02-01 8:28 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Christoph Hellwig, qemu-devel
On Tue, Jan 26, 2010 at 06:07:45PM -0600, Anthony Liguori wrote:
> On 01/26/2010 07:49 AM, Christoph Hellwig wrote:
> >If we go over the maximum number of iovecs support by syscall we get
> >back EINVAL from the kernel which translate to I/O errors for the guest.
> >
> >Add a MAX_IOV defintion for platforms that don't have it. For now we use
> >the same 1024 define that's used on Linux and various other platforms,
> >but until the windows block backend implements some kind of vectored I/O
> >it doesn't matter.
> >
> >Signed-off-by: Christoph Hellwig<hch@lst.de>
> >
>
> Applied. Thanks.
Can you also add it to the 0.12-stable series? There's tons of bug
reports from users seeing this regression in qemu-0.12.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-01 8:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-26 13:49 [Qemu-devel] [PATCH v2] block: avoid creating too large iovecs in multiwrite_merge Christoph Hellwig
2010-01-27 0:07 ` Anthony Liguori
2010-02-01 8:28 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).