From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1c1D-0002JA-Lv for qemu-devel@nongnu.org; Mon, 30 Jun 2014 09:53:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1c18-0004VX-W4 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 09:53:15 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:57742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1c18-0004VG-LJ for qemu-devel@nongnu.org; Mon, 30 Jun 2014 09:53:10 -0400 Received: by mail-wi0-f177.google.com with SMTP id r20so6064196wiv.4 for ; Mon, 30 Jun 2014 06:53:09 -0700 (PDT) Date: Mon, 30 Jun 2014 15:53:05 +0200 From: Stefan Hajnoczi Message-ID: <20140630135305.GA10229@stefanha-thinkpad.redhat.com> References: <1404109798-10303-1-git-send-email-cyliu@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline In-Reply-To: <1404109798-10303-1-git-send-email-cyliu@suse.com> Subject: Re: [Qemu-devel] [PATCH V4] qemu-img create: add 'nocow' option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu Cc: qemu-devel@nongnu.org, stefanha@redhat.com --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 30, 2014 at 02:29:58PM +0800, Chunyan Liu wrote: > Add 'nocow' option so that users could have a chance to set NOCOW flag to > newly created files. It's useful on btrfs file system to enhance performa= nce. >=20 > Btrfs has low 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 is to turn off COW attributes on VM files. Generally, there a= re > two ways to turn off NOCOW on btrfs: a) by mounting fs with nodatacow, th= en > all newly created files will be NOCOW. b) per file. Add the NOCOW file > attribute. It could only be done to empty or new files. >=20 > This patch tries the second way, according to the option, it could add NO= COW > per file. >=20 > For most block drivers, since the create file step is in raw-posix.c, so = we > can do setting NOCOW flag ioctl in raw-posix.c only. >=20 > But there are some exceptions, like block/vpc.c and block/vdi.c, they are > creating file by calling qemu_open directly. For them, do the same setting > NOCOW flag ioctl work in them separately. >=20 > Signed-off-by: Chunyan Liu > --- > Changes to v3: > * remove NOCOW option from .create_opts of those drivers calling > bdrv_create_file to create file. Adding NOCOW to raw-posix.c is > enough. No difference to users when using 'qemu-img create' interfa= ce. > Make the patch cleaner.=20 >=20 > block/qed.c | 6 +++--- > block/raw-posix.c | 25 +++++++++++++++++++++++++ > block/vdi.c | 29 +++++++++++++++++++++++++++++ > block/vmdk.c | 6 +++--- > block/vpc.c | 29 +++++++++++++++++++++++++++++ > include/block/block_int.h | 1 + > qemu-doc.texi | 16 ++++++++++++++++ > qemu-img.texi | 16 ++++++++++++++++ > 8 files changed, 122 insertions(+), 6 deletions(-) Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan --Q68bSM7Ycu6FN28Q Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTsWvBAAoJEJykq7OBq3PIsEUH/AqIU/2yK/y9DjkTk/rJd072 O2/p+riuP7dtfPsyz2quse/2fzpevVBKXR3JofeTGJZQseC3WpH01pVB6NcL6VcA iJGtV0RUyOE4ITvAdOCKRDMbYIZBiEMh1fTmiGxGfw2FEbJU+l9+bKU69gyCbZQ+ ZRQcqC7FIFvgeIxIEdz8QBNEQ9QW9yCo66RGCHLD9gmjng80/IuWpEzDuFBOufSo /7w5O+YF7RIHGrvmsrBoji3Pfp1lHzw1eXXUIGXrUp8U6n/g/SNr4IRPWHU8fROo WrU7nRwbkPpaLZZw8YZaa9Sy90IXJ2EVy31qx80MMYnLcrwhMFbSwiwx/LmZTUg= =XFdf -----END PGP SIGNATURE----- --Q68bSM7Ycu6FN28Q--