From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrRiO-0005Jl-Qx for qemu-devel@nongnu.org; Wed, 18 Jul 2012 06:42:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrRiJ-00079R-2p for qemu-devel@nongnu.org; Wed, 18 Jul 2012 06:42:44 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:34563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrRiI-00078e-PW for qemu-devel@nongnu.org; Wed, 18 Jul 2012 06:42:38 -0400 Date: Wed, 18 Jul 2012 06:42:24 -0400 (EDT) From: Paolo Bonzini Message-ID: <6594c5c3-1a6c-488f-8b18-ec1bc3e6728f@zmail13.collab.prod.int.phx2.redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 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: Stefan Hajnoczi Cc: Anthony Liguori , Stefan Hajnoczi , Markus Armbruster , Michael Tokarev , qemu-devel@nongnu.org, =?utf-8?Q?Llu=C3=ADs?= , Blue Swirl , Stefan Weil , Hannes Reinecke , Wenchao Xia > Whether to provide sync and/or async access is a key question. Indeed. > 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. Paolo