From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP6TP-00073D-Pc for qemu-devel@nongnu.org; Thu, 26 Sep 2013 03:59:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VP6TH-00046y-C2 for qemu-devel@nongnu.org; Thu, 26 Sep 2013 03:58:55 -0400 Received: from mail-ee0-x229.google.com ([2a00:1450:4013:c00::229]:53745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP6TH-00046s-4L for qemu-devel@nongnu.org; Thu, 26 Sep 2013 03:58:47 -0400 Received: by mail-ee0-f41.google.com with SMTP id d17so336305eek.14 for ; Thu, 26 Sep 2013 00:58:46 -0700 (PDT) Date: Thu, 26 Sep 2013 09:58:43 +0200 From: Stefan Hajnoczi Message-ID: <20130926075843.GC24531@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] qemu-img create: set "nocow" flag to solve performance issue on btrfs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu Cc: qemu-devel@nongnu.org On Wed, Sep 25, 2013 at 02:38:36PM +0800, Chunyan Liu wrote: > Btrfs has terrible performance when hosting VM images, even more when the > guest in those VM are also using btrfs as file system. > One way to mitigate this bad performance would be to turn off COW > attributes on VM files (since having copy on write for this kind of data is > not useful). We could improve qemu-img to ensure they flag newly created > images as "nocow". For those who want to use Copy-on-write (for > snapshotting, to share snapshots across VM, etc..) could be able to change > this behaviour by 'chattr', either globally or per VM. The full implications of the NOCOW attribute aren't clear to me. Does it really mean the file cannot be snapshotted? Or is it purely a data integrity issue where overwriting data in-place puts that data at risk in case of hardware/power failure? > I wonder could we add a patch to improve qemu-img create, to set 'nocow' > flag by default on newly created images? I think that would be fine. It's a ioctl(FS_IOC_SETFLAGS, FS_NOCOW_FL) call so not even too btrfs-specific. Stefan