From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzVP8-0000V6-TN for qemu-devel@nongnu.org; Mon, 20 Feb 2012 10:44:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RzVP7-0002nA-Nr for qemu-devel@nongnu.org; Mon, 20 Feb 2012 10:43:54 -0500 Received: from blade3.isti.cnr.it ([194.119.192.19]:4901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzVP7-0002le-Fl for qemu-devel@nongnu.org; Mon, 20 Feb 2012 10:43:53 -0500 Received: from [192.168.7.52] ([155.253.6.254]) by mx.isti.cnr.it (PMDF V6.5-x6 #31988) with ESMTPSA id <01OC7XRRYD2EJQIB7U@mx.isti.cnr.it> for qemu-devel@nongnu.org; Mon, 20 Feb 2012 16:43:06 +0100 (MET) Date: Mon, 20 Feb 2012 16:43:18 +0100 From: Virtbie In-reply-to: <4F42616D.30800@codemonkey.ws> Message-id: <4F426A16.9090609@shiftmail.org> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7bit References: <4F425643.2@shiftmail.org> <4F42616D.30800@codemonkey.ws> Subject: Re: [Qemu-devel] Is cache=writeback safe yet? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , qemu-devel@nongnu.org On 02/20/12 16:06, Anthony Liguori wrote: > On 02/20/2012 08:18 AM, Virtbie wrote: >> Dear qemuers, >> thanks for your exellent software. >> >> I would like to use cache=writeback, but I still can't understand if >> this is >> safe or not in case of power loss. > > "Safe" is too simplistic of a view. The documentation in > qemu-options.hx probably needs to be revisited. > > cache=writeback emulates a large disk cache much the same as every > modern hard drive has a builtin cache. > > The only real difference is that the host cache is very, very large. > Some modern file systems did not take the necessary steps to ensure > consistency when a volatile write cache is present (ext3 up until very > recently when barrier=1 became default). > > In practice, this didn't create a huge issue because disk write caches > are flushed often. Ted T'so has written a lot about the practical > bits here. > > But since the host cache is very large, and may not be flushed for > many minutes after the initial write, this can exacerbate the problem. > > In short, if you're using a recent kernel with ext3 or ext4, > cache=writeback is absolutely safe. If you're using an older version > of ext3, cache=writeback is still safe but ext3 itself isn't. > cache=writeback can make the situation worse. > > cache=writethrough presents a non-volatile cache which makes even > older ext3 filesystems safe. > > Regards, > > Anthony Liguori Great explanation Anthony, may I still ask: 1) Is WCE + volatile flag exposed to the guest, by all three virtual devices: - virtio - scsi - ide ? (if not, I still don't understand how this works) 2) Is there a minimum guest kernel and a minimum viostor Windows driver version, to see such WCE+volatile flag in a virtio disk, so that the guest OS can actually see the cache? Because I can't seem to find such flag for a virtio disk on a linux 2.6.38 guest and that seems serious to me. Is it visible somewhere in /sys hierarchy? Or is 2.6.38 too old? Thank you Vb.