From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeskI-0006nD-T6 for qemu-devel@nongnu.org; Tue, 21 May 2013 16:01:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeskD-0000Vh-R0 for qemu-devel@nongnu.org; Tue, 21 May 2013 16:01:18 -0400 Received: from atl4mhob06.myregisteredsite.com ([209.17.115.44]:42690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeskD-0000VO-MI for qemu-devel@nongnu.org; Tue, 21 May 2013 16:01:13 -0400 From: "Mark Trumpold" Message-ID: Date: Tue, 21 May 2013 20:01:10 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] 'qemu-nbd' explicit flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: markt@tachyon.net Hello all, I am using =E2=80=98qemu-nbd=E2=80=99 and =E2=80=98qemu-img=E2=80=99 from= the command line to provide =E2=80=98qcow2=E2=80=99 loop filesystems. F= or performance, I have '--cache=3Dwriteback' set for the qemu-nbd device.= I am having trouble flushing all caches to disk at will; specifically bef= ore snapshotting the underlying filesystem that hold the =E2=80=98qcow2=E2= =80=99 images. Environment: Qemu 1.2.0 Debian 6.0.5 Linux kernel 3.3.1 with Qemu patch to enable kernel flushing: http://thread.gmane.org/gmane.linux.drivers.nbd.general/1108 Usage example: 'qemu-nbd --cache=3Dwriteback -c /dev/nbd0 /images/my-qcow.img' 'mount /dev/nbd0 /my-mount-point' Everything does flush correctly when I first unmount and then disconnect = the device; however, in my case I am not able to unmount things before sn= apshotting. I tried several approaches externally to flush the device. For example: 'mount -o remount,ro /dev/nbd0' 'blockdev --flushbufs /dev/nbd0' I have been looking at the Qemu source code and in user space 'nbd.c' in = routine 'nbd_trip' I see the case 'NBD_CMD_FLUSH' which looks to be calle= d from the NBD socket interface. Here I see 'bdrv_co_flush(exp->bs)' whi= ch looks promising; however, I don't know how to setup the 'bs' pointer f= or the call. Ideally, I would like to add a command line parm to 'qemu-nbd.c' to expli= citely do the flush, but so far no luck. I've been struggling with this for some time. Any guidance would be grea= tly appreciated. Thank you, Mark Trumpold