From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXEs6-0003B1-1B for qemu-devel@nongnu.org; Mon, 07 Apr 2014 15:06:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXEs0-0006BE-Ap for qemu-devel@nongnu.org; Mon, 07 Apr 2014 15:06:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXEs0-0006B1-2W for qemu-devel@nongnu.org; Mon, 07 Apr 2014 15:06:12 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s37J6B90002796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Apr 2014 15:06:11 -0400 Message-ID: <5342F722.90503@redhat.com> Date: Mon, 07 Apr 2014 13:06:10 -0600 From: Eric Blake MIME-Version: 1.0 References: <1396891800-8627-1-git-send-email-mreitz@redhat.com> <1396891800-8627-2-git-send-email-mreitz@redhat.com> In-Reply-To: <1396891800-8627-2-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J06bF3DGkQafSm2a17hd8NI034JQ3hfpr" Subject: Re: [Qemu-devel] [PATCH 1/4] block-commit: Expose granularity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --J06bF3DGkQafSm2a17hd8NI034JQ3hfpr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/07/2014 11:29 AM, Max Reitz wrote: > Allow QMP users to manipulate the granularity used in the block-commit > command. >=20 > Signed-off-by: Max Reitz > --- > @@ -214,6 +215,13 @@ void commit_start(BlockDriverState *bs, BlockDrive= rState *base, > orig_base_flags =3D bdrv_get_flags(base); > orig_overlay_flags =3D bdrv_get_flags(overlay_bs); > =20 > + if (!granularity) { > + granularity =3D COMMIT_BUFFER_SIZE; > + } Default granularity of 0 becomes buffer size... > @@ -1876,6 +1876,15 @@ void qmp_block_commit(const char *device, > */ > BlockdevOnError on_error =3D BLOCKDEV_ON_ERROR_REPORT; > =20 > + granularity =3D has_granularity ? granularity : 0; > + > + if (has_granularity && > + (granularity < BDRV_SECTOR_SIZE || (granularity & (granularity= - 1)))) > + { > + error_set(errp, QERR_INVALID_PARAMETER, "granularity"); =2E..but this code rejects attempts for me to explicitly set granularity to the default. Should it be 'if (granularity &&' instead of your current wording? Also, is it worth using qemu-common.h's is_power_of_2 instead of inlining it yourself? (I don't care, as I recognize the bit manipulations, but other readers might prefer the named version for its legibility) > +++ b/qapi-schema.json > @@ -2112,6 +2112,9 @@ > # > # @speed: #optional the maximum speed, in bytes per second > # > +# @granularity: #optional the granularity to be used for the operation= , in > +# bytes; has to be a power of two and at least 512 (sinc= e 2.1) > +# At least you documented here that an explicit '0' is rejected, even though it might be nicer to allow it for the sake of requesting the default even if the default later changes in size. Overall, though, I'm liking this series. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --J06bF3DGkQafSm2a17hd8NI034JQ3hfpr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTQvciAAoJEKeha0olJ0Nq4ZsH/0DEaec+HYv93j0toyOdYsrA PvViyR9h0o+DeqGW67wqZWFN0OrDnNS0WZxBAG4jWVUoB2iyBz2NG0FAoL1Nxfy2 xa+3OnTj1r0D/ZOy2RyJu5/Ttx6RSzfavmtTKWihs4Yj+AU7fGX5NMAzexhV26Va qhqdUFWUrEaTaPxIYxyuuUToX+ejpwPyh/JVvCjJ8tb41Y5F5AZhF/Bb3eV4TDTz KwmD0tgTWs9o4NHQ4pZDW9ihaxXVxf7cvuqp/siKUk+42s5FwZRETxKZ//hN/b10 Vlh5nYCu1+QFulCWzOxI/pt5bx/8w+A5phLHPPYYw4Fm0IyjLNbhvIs50lbUcp8= =Jn3K -----END PGP SIGNATURE----- --J06bF3DGkQafSm2a17hd8NI034JQ3hfpr--