From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrWBY-0004KA-MV for qemu-devel@nongnu.org; Thu, 11 Aug 2011 10:24:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrWBU-0005b8-5U for qemu-devel@nongnu.org; Thu, 11 Aug 2011 10:24:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrWBT-0005as-TI for qemu-devel@nongnu.org; Thu, 11 Aug 2011 10:24:32 -0400 Message-ID: <4E43E619.601@redhat.com> Date: Thu, 11 Aug 2011 16:24:25 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1312478089-806-1-git-send-email-pbonzini@redhat.com> <1312478089-806-6-git-send-email-pbonzini@redhat.com> <20110811075836.GB29542@stefanha-thinkpad.localdomain> <4E43C6CE.9070008@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/10] dma-helpers: add dma_buf_read and dma_buf_write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org On 08/11/2011 03:29 PM, Stefan Hajnoczi wrote: >> > >> > What do you think about passing the residual bytes for short transfers? >> > Should I look into updating BlockDriverCompletionFunc, or is the approach >> > of patch 2 okay? If I have an excuse to learn more about Coccinelle, that >> > can be fun.:) > The bdrv_aio_readv() and bdrv_aio_writev() functions don't have the > concept of residual bytes. They only work on fully completed I/O > operations. If there is an error they pass -errno. But if a transfer was split due to failure of cpu_physical_memory_map, and only the second part fails, you can have a short transfer and you need to pass residual bytes back. The only way out of this is to make a bounce buffer as big as all the unmappable parts of the S/G list, which is undesirable of course. So the residual bytes are a general DMA concept, not specific to SCSI. > Therefore I don't think BlockDriverCompletionFunc is the right type > to add residual bytes to. Right, I would rather update BlockDriverCompletionFunc to pass the AIOCB as a third parameter, and store the residual bytes in the DMAAIOCB (with a getter that the completion function can use). Paolo