Received: from eggs.gnu.org ([2001:4830:134:3::10]:40179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi0z8-0001Kb-QR for qemu-devel@nongnu.org; Thu, 08 Sep 2016 11:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi0z3-0004Vj-B8 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 11:11:25 -0400 References: <20160829171021.4902-1-pbutsykin@virtuozzo.com> <20160829171021.4902-5-pbutsykin@virtuozzo.com> From: Eric Blake Message-ID: <663cb170-71b3-3ca1-ce61-b8b8defa6147@redhat.com> Date: Thu, 8 Sep 2016 10:11:07 -0500 MIME-Version: 1.0 In-Reply-To: <20160829171021.4902-5-pbutsykin@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bcjHc1fKsPilNxUuvGkMXIAv8bk5DBk4c" Subject: Re: [Qemu-devel] [PATCH RFC v2 04/22] block/pcache: add pcache debug build List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Butsykin , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com, famz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bcjHc1fKsPilNxUuvGkMXIAv8bk5DBk4c From: Eric Blake To: Pavel Butsykin , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com, famz@redhat.com Message-ID: <663cb170-71b3-3ca1-ce61-b8b8defa6147@redhat.com> Subject: Re: [PATCH RFC v2 04/22] block/pcache: add pcache debug build References: <20160829171021.4902-1-pbutsykin@virtuozzo.com> <20160829171021.4902-5-pbutsykin@virtuozzo.com> In-Reply-To: <20160829171021.4902-5-pbutsykin@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/29/2016 12:10 PM, Pavel Butsykin wrote: > Signed-off-by: Pavel Butsykin > --- > block/pcache.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/block/pcache.c b/block/pcache.c > index 74a4bc4..7f221d6 100644 > --- a/block/pcache.c > +++ b/block/pcache.c > @@ -28,6 +28,15 @@ > #include "qapi/error.h" > #include "qapi/qmp/qstring.h" > =20 > +#define PCACHE_DEBUG Are you sure you want this left enabled? > + > +#ifdef PCACHE_DEBUG > +#define DPRINTF(fmt, ...) \ > + printf("%s:%s:%d "fmt, __FILE__, __func__, __LINE__, ## __VA_A= RGS__) > +#else > +#define DPRINTF(fmt, ...) do { } while (0) > +#endif NACK. This leads to bitrot when PCACHE_DEBUG is not defined. Also, we typically send debug to stderr, not stdout. Instead, please follow the lead of many other debug places, which do something similar to this (off the top of my head, therefore untested): #ifdef PCACHE_DEBUG # define PCACHE_DEBUG_PRINT 1 #else # define PCACHE_DEBUG_PRINT 0 #endif #define DPRINTF(fmt, ...) \ do { \ if (PCACHE_DEBUG_PRINT) { \ fprintf(stderr, ... __VA_ARGS__) \ } \ } while (0) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --bcjHc1fKsPilNxUuvGkMXIAv8bk5DBk4c 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/ iQEcBAEBCAAGBQJX0X+MAAoJEKeha0olJ0NqZG0H/Apb5X51Tslry20+WnP4qDiP 8/7OEVZHWwMdplpNeunFbiKjdS5YtRyYNcCJ1w6rSJw6Sui9zwUsQTj7CLcjep1v bD4cJ2V8Az5rOX4orZG8txY5PkFxZ4wxvjfJpSL0BQ4yfarZs6nt5tL7JgLAZblg 9Fvph4OR0egEs898JrtGrPQc+SabNM5X7utgkO4PbhEJOSRFD//Hig7he7l2rCrc m2XvP2XE3/y0qNVbLk1G6/oNgQ6PT0UgU7TiCYsEG+PbTUXJZc6+x3jDxbGkQKck Nny1ROx54YUm/gyEDf8FaZ070JeAXjj0P2MSRKLKD4dgk99sFiJqRpjbdejs8j4= =7McR -----END PGP SIGNATURE----- --bcjHc1fKsPilNxUuvGkMXIAv8bk5DBk4c--