From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LOxQY-0007Sy-Ki for qemu-devel@nongnu.org; Mon, 19 Jan 2009 11:56:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LOxQU-0007SR-8Y for qemu-devel@nongnu.org; Mon, 19 Jan 2009 11:56:41 -0500 Received: from [199.232.76.173] (port=38715 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOxQU-0007SO-2B for qemu-devel@nongnu.org; Mon, 19 Jan 2009 11:56:38 -0500 Received: from mail-bw0-f16.google.com ([209.85.218.16]:41298) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOxQT-0006K7-G3 for qemu-devel@nongnu.org; Mon, 19 Jan 2009 11:56:37 -0500 Received: by bwz9 with SMTP id 9so51018bwz.8 for ; Mon, 19 Jan 2009 08:56:35 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1232308399-21679-4-git-send-email-avi@redhat.com> References: <1232308399-21679-1-git-send-email-avi@redhat.com> <1232308399-21679-4-git-send-email-avi@redhat.com> Date: Mon, 19 Jan 2009 18:54:45 +0200 Message-ID: Subject: Re: [Qemu-devel] [PATCH 3/5] Vectored block device API From: Blue Swirl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 1/18/09, Avi Kivity wrote: > Most devices that are capable of DMA are also capable of scatter-gather. > With the memory mapping API, this means that the device code needs to be > able to access discontiguous host memory regions. > > For block devices, this translates to vectored I/O. This patch implements > an aynchronous vectored interface for the qemu block devices. At the moment > all I/O is bounced and submitted through the non-vectored API; in the future > we will convert block devices to natively support vectored I/O wherever > possible. > > Signed-off-by: Avi Kivity > +static void flatten_iovec(VectorTranslationState *s) > +{ > + uint8_t *p = s->bounce; > + int i; > + > + for (i = 0; i < s->niov; ++i) { > + memcpy(p, s->iov[i].iov_base, s->iov[i].iov_len); > + p += s->iov[i].iov_len; > + } > +} > + > +static void unflatten_iovec(VectorTranslationState *s) > +{ > + uint8_t *p = s->bounce; > + int i; > + > + for (i = 0; i < s->niov; ++i) { > + memcpy(s->iov[i].iov_base, p, s->iov[i].iov_len); > + p += s->iov[i].iov_len; > + } > +} I think these should be moved to vl.c together with patch 4 stuff, they are not block device specific.