On 08.09.2016 18:49, Pavel Butsykin wrote:
On 08.09.2016 18:11, Eric Blake wrote:
On 08/29/2016 12:10 PM, Pavel Butsykin wrote:
Signed-off-by: Pavel Butsykin <pbutsy...@virtuozzo.com>
---
  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?

No.

+
+#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)


OK, thanks!

Can I replace DPRINTFs on tracepoints?

Reply via email to