From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4p3n-0000Wb-5O for qemu-devel@nongnu.org; Sat, 17 Sep 2011 03:11:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4p3m-00030c-4k for qemu-devel@nongnu.org; Sat, 17 Sep 2011 03:11:35 -0400 Received: from mtagate7.uk.ibm.com ([194.196.100.167]:48556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4p3l-0002zO-Ns for qemu-devel@nongnu.org; Sat, 17 Sep 2011 03:11:34 -0400 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate7.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p8H7BBbN005901 for ; Sat, 17 Sep 2011 07:11:11 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8H7BB6j2572334 for ; Sat, 17 Sep 2011 08:11:11 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8H7BA8l011124 for ; Sat, 17 Sep 2011 01:11:11 -0600 Date: Sat, 17 Sep 2011 08:11:10 +0100 From: Stefan Hajnoczi Message-ID: <20110917071110.GA25785@stefanha-thinkpad.localdomain> References: <1315628610-28222-1-git-send-email-ronniesahlberg@gmail.com> <1315628610-28222-2-git-send-email-ronniesahlberg@gmail.com> <20110912091408.GA3465@stefanha-thinkpad.localdomain> <20110914143608.GB12218@lst.de> <20110916155320.GA28201@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110916155320.GA28201@lst.de> Subject: Re: [Qemu-devel] [PATCH] This patch adds a new block driver : iSCSI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: kwolf@redhat.com, Stefan Hajnoczi , fujita.tomonori@lab.ntt.co.jp, Ronnie Sahlberg , qemu-devel@nongnu.org On Fri, Sep 16, 2011 at 05:53:20PM +0200, Christoph Hellwig wrote: > On Wed, Sep 14, 2011 at 04:50:25PM +0100, Stefan Hajnoczi wrote: > > I think in this case it will not make the code nicer. Since the > > external iSCSI library is based on callbacks it would be necessary to > > write the coroutines<->callbacks adapter functions. So for example, > > the READ10 command would need a function that can be called in > > coroutine context and yields while libiscsi does the I/O. When the > > callback is invoked it will re-enter the coroutine. > > > > The area where coroutines are useful in the block layer is for image > > formats. We already have common coroutines<->callback adapter > > functions in block.c so it's possible to write sequential code for > > image formats. They only need access to block layer functions which > > have already been adapted. But as soon as you interact with a > > callback-based API from the coroutine, then you need to write an > > adapter yourself. > > So you plan on keeping the aio interface around forever? Qemu with two > different I/O pathes was already more than painful enough, I don't > think keeping three, and two of them beeing fairly complex is a good > idea. The synchronous interfaces can be converted to the coroutine interfaces. The block layer needs a public aio interface because device emulation is asynchronous/callback-based. That doesn't mean that BlockDriver needs aio functions since block.c could transparently set up coroutines. So in theory BlockDriver could have only coroutine interfaces. Doing the aio to coroutine conversion is pretty mechanical, that's why I'm not afraid of doing it with this iSCSI code later. Stefan