From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZvRo-0000f2-K1 for qemu-devel@nongnu.org; Tue, 26 Jan 2010 19:07:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZvRk-0000eq-7G for qemu-devel@nongnu.org; Tue, 26 Jan 2010 19:07:52 -0500 Received: from [199.232.76.173] (port=60622 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZvRk-0000en-0o for qemu-devel@nongnu.org; Tue, 26 Jan 2010 19:07:48 -0500 Received: from mail-iw0-f188.google.com ([209.85.223.188]:39899) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZvRj-00063J-L3 for qemu-devel@nongnu.org; Tue, 26 Jan 2010 19:07:47 -0500 Received: by mail-iw0-f188.google.com with SMTP id 26so5513513iwn.14 for ; Tue, 26 Jan 2010 16:07:47 -0800 (PST) Message-ID: <4B5F83D1.3000101@codemonkey.ws> Date: Tue, 26 Jan 2010 18:07:45 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2] block: avoid creating too large iovecs in multiwrite_merge References: <20100126134908.GA1883@lst.de> In-Reply-To: <20100126134908.GA1883@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org 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 > 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 > #endif > > > >