From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Le8yM-0005rC-09 for qemu-devel@nongnu.org; Mon, 02 Mar 2009 09:18:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Le8yJ-0005qz-Hy for qemu-devel@nongnu.org; Mon, 02 Mar 2009 09:18:20 -0500 Received: from [199.232.76.173] (port=44311 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Le8yJ-0005qw-Ar for qemu-devel@nongnu.org; Mon, 02 Mar 2009 09:18:19 -0500 Received: from qw-out-1920.google.com ([74.125.92.150]:27541) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Le8yJ-0001Lp-0Y for qemu-devel@nongnu.org; Mon, 02 Mar 2009 09:18:19 -0500 Received: by qw-out-1920.google.com with SMTP id 4so1753169qwk.4 for ; Mon, 02 Mar 2009 06:18:16 -0800 (PST) Message-ID: <49ABEAA5.1010003@codemonkey.ws> Date: Mon, 02 Mar 2009 08:18:13 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Citrix VHD implementation References: <49ACE6E7-4C5B-4AC5-A8FD-29D2201DE9D1@schmidp.com> In-Reply-To: <49ACE6E7-4C5B-4AC5-A8FD-29D2201DE9D1@schmidp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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 Philipp Schmid wrote: > Hi, > > as some of you might know, citrix has open sourced the library they > use to read and write to VHD disk images. > > I'm trying to implementing a block-vhd driver on top of libvhd, but my > C knowledge is very limited as I haven't written any code in C for a > long time. > > What I already have is a git repo with the libvhd code extracted from > the xen-unstable tree with the blocktap2 patches applied. > libvhd also comes with vhd-util, a utility to create and modify vhd > images. > I have only tried to compile it on ubuntu 8.10, so it might not work > on your system. > > The git repo is hosted on github: > http://github.com/schmidp/libvhd/tree/master I took a look at the libvhd code. I don't think I'd want to replace the QEMU vpc code with it so if you plan on pushing your work upstream eventually, you may want to consider other options. The libvhd code provides a synchronous IO interface. While it's relatively clean wrt using a global context, you'd have to hold a lock to ensure thread safety if you were to attempt to make it asynchronous with threads. Because the read function blocks (while you were holding the global context lock), it's more or less impossible to use threads to make it asynchronous while supporting multiple requests. The sum of this means that it's not going to fit into QEMU very well and doesn't make sense as a long term mechanism for VHD support in QEMU. Ideally, the libvhd code would be implemented entirely with asynchronous IO functions that could be pluggable. That's quite a different beast though from the current implementation. Regards, Anthony Liguori > Are there any docs about how to implement a block driver for qemu? > As far as I have seen from the qemu code, block_int.h defines the > interface and you register your driver in block.c, but that is all > I've found out so far. > > I will try to implement a synchrones driver first as it seems more > simple... > > > greets Philipp > > ps: I'm not affiliated with citrix in any way > > >