diff mbox

[V3,5/7] qcow2: use debug events for snapshot

Message ID 1378695482-29805-6-git-send-email-xiawenc@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wayne Xia Sept. 9, 2013, 2:58 a.m. UTC
For those error paths which can't be triggered by other debug event,
use snapshot debug events.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 block/qcow2-snapshot.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Eric Blake Sept. 30, 2013, 9:41 p.m. UTC | #1
On 09/08/2013 08:58 PM, Wenchao Xia wrote:
> For those error paths which can't be triggered by other debug event,
> use snapshot debug events.
> 
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  block/qcow2-snapshot.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

I would have squashed 4 and 5 into a single patch (declaring the enums
doesn't add any functionality without the event actually using the enum
values, and neither patch is so large in isolation where combining them
would ips the balance towards too large).
diff mbox

Patch

diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index e0b7a5a..92b87f8 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -198,6 +198,7 @@  static int qcow2_write_snapshots(BlockDriverState *bs)
     }
 
 
+    BLKDBG_EVENT(bs->file, BLKDBG_SNAPSHOT_LIST_UPDATE);
     /* Write all snapshots to the new list */
     for(i = 0; i < s->nb_snapshots; i++) {
         sn = s->snapshots + i;
@@ -264,6 +265,7 @@  static int qcow2_write_snapshots(BlockDriverState *bs)
     header_data.nb_snapshots        = cpu_to_be32(s->nb_snapshots);
     header_data.snapshots_offset    = cpu_to_be64(snapshots_offset);
 
+    BLKDBG_EVENT(bs->file, BLKDBG_SNAPSHOT_HEADER_UPDATE);
     ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, nb_snapshots),
                            &header_data, sizeof(header_data));
     if (ret < 0) {
@@ -375,6 +377,7 @@  int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
         l1_table[i] = cpu_to_be64(s->l1_table[i]);
     }
 
+    BLKDBG_EVENT(bs->file, BLKDBG_SNAPSHOT_L1_UPDATE);
     ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT,
             sn->l1_table_offset, s->l1_size * sizeof(uint64_t));
     if (ret < 0) {