Skip to contentSkip to conversation

qcow2: use always stderr for debugging

PATCH Applied Frediano Ziglio 3 participants 3 messages Aug 25, 2011 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qcow2: use always stderr for debugging

let all DEBUG_ALLOC2 printf goes to stderr

---
 block/qcow2-cluster.c  |    2 +-
 block/qcow2-refcount.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
block/qcow2-cluster.c +1 -1
index 9269dda..9034840 100644
@@ -53,7 +53,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size, bool exact_size)
     }
 
 #ifdef DEBUG_ALLOC2
-    printf("grow l1_table from %d to %d\n", s->l1_size, new_l1_size);
+    fprintf(stderr, "grow l1_table from %d to %d\n", s->l1_size, new_l1_size);
 #endif
 
     new_l1_size2 = sizeof(uint64_t) * new_l1_size;
block/qcow2-refcount.c +2 -2
index 2a915be..fbf28da 100644
@@ -422,7 +422,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
     int ret;
 
 #ifdef DEBUG_ALLOC2
-    printf("update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%d\n",
+    fprintf(stderr, "update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%d\n",
            offset, length, addend);
 #endif
     if (length < 0) {
@@ -556,7 +556,7 @@ retry:
         }
     }
 #ifdef DEBUG_ALLOC2
-    printf("alloc_clusters: size=%" PRId64 " -> %" PRId64 "\n",
+    fprintf(stderr, "alloc_clusters: size=%" PRId64 " -> %" PRId64 "\n",
             size,
             (s->free_cluster_index - nb_clusters) << s->cluster_bits);
 #endif
Signature · 1 line
1.7.1
#2 lore raw
In reply to Frediano Ziglio
Quoted 35 lines · Frediano Ziglio

let all DEBUG_ALLOC2 printf goes to stderr

---
  block/qcow2-cluster.c  |    2 +-
  block/qcow2-refcount.c |    4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)
block/qcow2-cluster.c +1 -1
index 9269dda..9034840 100644
@@ -53,7 +53,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size, bool exact_size)
      }
 
  #ifdef DEBUG_ALLOC2
-    printf("grow l1_table from %d to %d\n", s->l1_size, new_l1_size);
+    fprintf(stderr, "grow l1_table from %d to %d\n", s->l1_size, new_l1_size);
  #endif
 
      new_l1_size2 = sizeof(uint64_t) * new_l1_size;
block/qcow2-refcount.c +1 -1
index 2a915be..fbf28da 100644
@@ -422,7 +422,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
      int ret;
 
  #ifdef DEBUG_ALLOC2
-    printf("update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%d\n",
+    fprintf(stderr, "update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%d\n",
             offset, length, addend);
  #endif
      if (length<  0) {

block/qcow2-refcount.c retry: · line 562

Quoted 8 lines
block/qcow2-refcount.c +1 -1
@@ -556,7 +556,7 @@ retry:
          }
      }
  #ifdef DEBUG_ALLOC2
-    printf("alloc_clusters: size=%" PRId64 " ->  %" PRId64 "\n",
+    fprintf(stderr, "alloc_clusters: size=%" PRId64 " ->  %" PRId64 "\n",
              size,
              (s->free_cluster_index - nb_clusters)<<  s->cluster_bits);
  #endif

Adding trace events would be even better, no?

Paolo