Received: from eggs.gnu.org ([2001:4830:134:3::10]:56708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5Gic-0005uq-Ob for qemu-devel@nongnu.org; Tue, 24 May 2016 14:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5Gia-00040w-PI for qemu-devel@nongnu.org; Tue, 24 May 2016 14:06:13 -0400 References: <1463470536-8981-1-git-send-email-famz@redhat.com> <1463470536-8981-15-git-send-email-famz@redhat.com> From: Max Reitz Message-ID: <686a2711-4159-1b31-580a-2e8bca1130aa@redhat.com> Date: Tue, 24 May 2016 20:06:01 +0200 MIME-Version: 1.0 In-Reply-To: <1463470536-8981-15-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mOT4iM8GGSPpNkjJb09FDAO3lVvHBQwSQ" Subject: Re: [Qemu-devel] [PATCH v5 14/27] qemu-img: Add "-L" option to sub commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , Markus Armbruster , Eric Blake , John Snow , qemu-block@nongnu.org, berrange@redhat.com, pbonzini@redhat.com, den@openvz.org, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mOT4iM8GGSPpNkjJb09FDAO3lVvHBQwSQ From: Max Reitz To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , Markus Armbruster , Eric Blake , John Snow , qemu-block@nongnu.org, berrange@redhat.com, pbonzini@redhat.com, den@openvz.org, stefanha@redhat.com Message-ID: <686a2711-4159-1b31-580a-2e8bca1130aa@redhat.com> Subject: Re: [PATCH v5 14/27] qemu-img: Add "-L" option to sub commands References: <1463470536-8981-1-git-send-email-famz@redhat.com> <1463470536-8981-15-git-send-email-famz@redhat.com> In-Reply-To: <1463470536-8981-15-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 17.05.2016 09:35, Fam Zheng wrote: > If specified, BDRV_O_NO_LOCK flag will be set when opening the image. >=20 > Signed-off-by: Fam Zheng > --- > qemu-img.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++----= -------- > 1 file changed, 72 insertions(+), 17 deletions(-) >=20 > diff --git a/qemu-img.c b/qemu-img.c > index 4792366..b13755b 100644 > --- a/qemu-img.c > +++ b/qemu-img.c [...] > @@ -1206,6 +1220,7 @@ static int img_compare(int argc, char **argv) > qemu_progress_init(progress, 2.0); > =20 > flags =3D 0; > + flags |=3D nolock ? BDRV_O_NO_LOCK : 0; This reads weird. I'd either put this line below bdrv_parse_cache_mode() or drop the line initializing src_flags to 0 (and make this a plain assignment). > ret =3D bdrv_parse_cache_mode(cache, &flags, &writethrough); > if (ret < 0) { > error_report("Invalid source cache option: %s", cache); [...] > @@ -1907,6 +1926,7 @@ static int img_convert(int argc, char **argv) > } > =20 > src_flags =3D 0; > + src_flags |=3D nolock ? BDRV_O_NO_LOCK : 0; Same here. Also: Should we have distinct flags for source and target for convert? For instance, I can imagine someone wanting not to lock the source but leave the target in default exclusive mode. > ret =3D bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethr= ough); > if (ret < 0) { > error_report("Invalid source cache option: %s", src_cache); [...] > @@ -2881,6 +2924,7 @@ static int img_rebase(int argc, char **argv) > qemu_progress_print(0, 100); > =20 > flags =3D BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0); > + flags |=3D nolock ? BDRV_O_NO_LOCK : 0; > ret =3D bdrv_parse_cache_mode(cache, &flags, &writethrough); > if (ret < 0) { > error_report("Invalid cache option: %s", cache); What about the source/base image? And again, would it make sense to have distinct flags for source and target? Max --mOT4iM8GGSPpNkjJb09FDAO3lVvHBQwSQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXRJgJAAoJEDuxQgLoOKytg1IIAJGFxeq6ih9sZb6RqguNApW0 /sbkjeC0uRu+mGblkTf2/QyiCVXuB0GfCh+4yLzqXQlGqte0Ld+Zq8SB7Bdg/8eD VpMGRSIiRRrXjJkzRNUDQgoj1AUlz3SIXmuyy2Z86JKi4KtJBnSVoa1lZmmpBobL t0BMDyy2uDhKd30aQbWf+VYeD+Wqb221NmUGrWapjmpy0Db2XIMfrycsN5vRdbmD 8WkCow1xnmbmjUK8fB2PSWSF5KR6qfhYkTAqWU7GtU0/l/n+t4erOgW5D7crQCvL afshBkrEuB1j7Je9Cmaz/hgH7/D1nRmOb0qRp8xbeAEuaNYD6O201jCvdoX1aRU= =9HQa -----END PGP SIGNATURE----- --mOT4iM8GGSPpNkjJb09FDAO3lVvHBQwSQ--