From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTio-0001sE-9b for qemu-devel@nongnu.org; Wed, 18 Jul 2012 08:51:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrTiR-0005YW-KE for qemu-devel@nongnu.org; Wed, 18 Jul 2012 08:51:18 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:42945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTiR-0005Vr-C3 for qemu-devel@nongnu.org; Wed, 18 Jul 2012 08:50:55 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Jul 2012 13:50:51 +0100 Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6ICon7a2547764 for ; Wed, 18 Jul 2012 13:50:49 +0100 Received: from d06av03.portsmouth.uk.ibm.com (localhost.localdomain [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6IComtg001683 for ; Wed, 18 Jul 2012 06:50:48 -0600 Date: Wed, 18 Jul 2012 13:50:47 +0100 From: Stefan Hajnoczi Message-ID: <20120718125047.GA19996@stefanha-thinkpad.localdomain> References: <6594c5c3-1a6c-488f-8b18-ec1bc3e6728f@zmail13.collab.prod.int.phx2.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6594c5c3-1a6c-488f-8b18-ec1bc3e6728f@zmail13.collab.prod.int.phx2.redhat.com> Subject: Re: [Qemu-devel] [RFC] introduce a dynamic library to expose qemu block API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Anthony Liguori , Stefan Hajnoczi , Michael Tokarev , =?iso-8859-1?Q?Llu=EDs?= , qemu-devel@nongnu.org, Blue Swirl , Stefan Weil , Hannes Reinecke , Wenchao Xia , Markus Armbruster On Wed, Jul 18, 2012 at 06:42:24AM -0400, Paolo Bonzini wrote: > > Synchronous APIs are great for writing dedicated tools like dd, cp, > > convert, etc. > > > > Asynchronous APIs are essential for integrating image file I/O into > > event-driven programs like libvirt. Here, the ability to do other > > things while image file I/O is in progress is a requirement. It may > > also be necessary to cancel or timeout if an operation is not making > > progress or the user decides to stop it. > > > > I think we need to provide both sync and async. Libraries like > > libssh2 and libcurl already do this so their APIs can be used as a > > starting point for async I/O. > > If we want to provide an asynchronous API, the easiest thing would > be to provide a GSource and that's it. That would even make sense for > QEMU itself, in fact. > > What I'm worried about, is how to support _both_ synchronous and > asynchronous access. I'd like the library to be clean of things like > qemu_aio_wait() and qemu_aio_flush(), at least in the beginning. > That's why I think async can come later, once we actually get > applications needing it. Right now, libvirt's requirements are > simple (e.g. probing the backing file chain) and would be synchronous > anyway. Yes, qemu_aio_wait() and qemu_aio_flush() are ugly. Starting with sync makes sense, it's a convenient API to have even if we add async later. Stefan