From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHCbA-0000Pm-4n for qemu-devel@nongnu.org; Mon, 20 Jul 2015 11:03:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHCb8-0005nU-FJ for qemu-devel@nongnu.org; Mon, 20 Jul 2015 11:03:20 -0400 References: From: Eric Blake Message-ID: <55AD0DA9.20606@redhat.com> Date: Mon, 20 Jul 2015 09:03:05 -0600 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="P9c4kPw1O7Umb2HH7jTFSGcMIwHDAnVSk" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/2] ignore bdrv_flush operation when no qcow2 cache item is dirty List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qingshu Chen , qemu-block@nongnu.org Cc: kwolf@redhat.com, "qemu-devel@nongnu.org" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --P9c4kPw1O7Umb2HH7jTFSGcMIwHDAnVSk Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [patches should always be sent to qemu-devel, even if qemu-block is also in the to/cc list] On 07/08/2015 01:26 AM, Qingshu Chen wrote: > qcow2_cache_flush() writes dirty cache to the disk and invokes bdrv_flu= sh() > to make the data durable. But even if there is no dirty cache, > qcow2_cache_flush() would invoke bdrv_flush(). In fact, bdrv_flush() w= ill > invoke fdatasync(), and it is an expensive operation. The patch will no= t > invoke bdrv_flush if there is not dirty cache. The reason that I modify= the > return value of qcow2_cache_flush() is qcow2_co_flush_to_os needs to k= now > whether flush operation is called. Following is the patch: >=20 >>>From 23f9f83da4178e8fbb53d2cffe128f5a2d3a239a Mon Sep 17 00:00:00 2001 > From: Qingshu Chen > Date: Wed, 1 Jul 2015 14:45:23 +0800 > Subject: [PATCH 1/2] ignore bdrv_flush operation when no qcow2 cache it= em is > dirty > Signed-off-by: Qingshu Chen I didn't quickly find an associated 2/2 patch; are you sure you sent the series correctly? >=20 > --- > block/qcow2-cache.c | 9 ++++++++- > block/qcow2.c | 2 ++ > 2 files changed, 10 insertions(+), 1 deletion(-) >=20 > diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c > index ed92a09..57c0601 100644 > --- a/block/qcow2-cache.c > +++ b/block/qcow2-cache.c > @@ -174,6 +174,7 @@ int qcow2_cache_flush(BlockDriverState *bs, Qcow2Ca= che > *c) > int result =3D 0; > int ret; > int i; > + int flag =3D 0; This is used as a bool, so declare it as such (bool flag =3D false;). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --P9c4kPw1O7Umb2HH7jTFSGcMIwHDAnVSk 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVrQ2tAAoJEKeha0olJ0NqZMcH/1hhgyRWcdAmp/8l4QvgrAqh Or+ThEPd/Twg5N+/FGFQ1aObFceLsRVj0GkrmJIw41rXEHlHsAs1t3crioTz44Bs zlpbodHyF33tTgOjuzrSs63iPqkWV53ydaBCuAMk+nTwLPWACGx8uUZ2de7GeAga 8RsybUzMG5P9iJ4kZPgV7X9b5nMFXG1KM7Gqe0f3/c4JT29qY5xErG08WBtcTLaV USb41AR/dnUlJjrv9xtMOMWdZRl9nqVTbn40Z7wrpGKnstFff62KBQe45xuDO3BX wECWzeTpz+52tM/WJEMtCNyjgqniC7ijMObJup6P01TWivpFOd2/za4wSU9D6VU= =flak -----END PGP SIGNATURE----- --P9c4kPw1O7Umb2HH7jTFSGcMIwHDAnVSk--