qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH RFC v2 04/22] block/pcache: add pcache debug bui


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH RFC v2 04/22] block/pcache: add pcache debug build
Date: Thu, 8 Sep 2016 10:11:07 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 08/29/2016 12:10 PM, Pavel Butsykin wrote:
> Signed-off-by: Pavel Butsykin <address@hidden>
> ---
>  block/pcache.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> 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"
>  
> +#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_ARGS__)
> +#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)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]