From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0Udb-0007dh-GC for qemu-devel@nongnu.org; Fri, 27 Jun 2014 07:48:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0UdU-0006kw-Ne for qemu-devel@nongnu.org; Fri, 27 Jun 2014 07:48:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0UdU-0006kE-FN for qemu-devel@nongnu.org; Fri, 27 Jun 2014 07:48:08 -0400 Date: Fri, 27 Jun 2014 13:48:06 +0200 From: Stefan Hajnoczi Message-ID: <20140627114806.GM12061@stefanha-thinkpad.muc.redhat.com> References: <1403515022-24802-1-git-send-email-cyliu@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jB+02Y6wHc2pEa2x" Content-Disposition: inline In-Reply-To: <1403515022-24802-1-git-send-email-cyliu@suse.com> Subject: Re: [Qemu-devel] [PATCH V3] 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 --jB+02Y6wHc2pEa2x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 23, 2014 at 05:17:02PM +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 v2: > * based on QemuOpts instead of old QEMUOptionParameters > * add nocow description in man page and html doc >=20 > Old v2 is here: > http://lists.gnu.org/archive/html/qemu-devel/2013-11/msg02429.html >=20 > --- > block/cow.c | 5 +++++ > block/qcow.c | 5 +++++ > block/qcow2.c | 5 +++++ > block/qed.c | 11 ++++++++--- > block/raw-posix.c | 25 +++++++++++++++++++++++++ > block/vdi.c | 29 +++++++++++++++++++++++++++++ > block/vhdx.c | 5 +++++ > block/vmdk.c | 11 ++++++++--- > block/vpc.c | 29 +++++++++++++++++++++++++++++ > include/block/block_int.h | 1 + > qemu-doc.texi | 16 ++++++++++++++++ > qemu-img.texi | 16 ++++++++++++++++ > 12 files changed, 152 insertions(+), 6 deletions(-) Are you sure it's necessary to touch all image formats in order to pass through the nocow option? Looking at bdrv_img_create() I think it will work without touching all image formats since both drv and proto_drv->create_opts are appended: void bdrv_img_create(const char *filename, const char *fmt, const char *base_filename, const char *base_fmt, char *options, uint64_t img_size, int flags, Error **errp, bool quiet) { QemuOptsList *create_opts =3D NULL; =2E.. create_opts =3D qemu_opts_append(create_opts, drv->create_opts); create_opts =3D qemu_opts_append(create_opts, proto_drv->create_opts); /* Create parameter list with default values */ opts =3D qemu_opts_create(create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size); /* Parse -o options */ if (options) { if (qemu_opts_do_parse(opts, options, NULL) !=3D 0) { error_setg(errp, "Invalid options for file format '%s'", fmt); goto out; } } --jB+02Y6wHc2pEa2x Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTrVn2AAoJEJykq7OBq3PIiZAIAL1SSG3chzx+4bLbbpdY5LFL znoHWkB2AfXGHgyE6pRm5T8b9tmX9zcamk+Sg90ZWCjop7Z0ltS+wEqqCIRdclPU oyiUA0GR9wBZM9GNP3dGCL5+6ONps+H9po5HQ3oFXtWaphVVt/v1Zvn/2mbvHVTW mC6NCjQG49/Dznsq59kAn7fGGSl9qIjcBiq6uzjQw7zv57wJztT217KiGh9b9h4z TSWf+1QY9OxIsqSdSZ/TUNJ4vE2UHOJBBqVJHDki9OKA+idG39RkiLqB0uEFDDT8 Asj68hXczALr8vcUsZnpc+CMvc2v+S1+F+y6kjMzswMXxPHg3R5G6t9XA+utNh4= =04KO -----END PGP SIGNATURE----- --jB+02Y6wHc2pEa2x--