Commit 6cbc3031 authored by Philipp Hahn's avatar Philipp Hahn Committed by Kevin Wolf
Browse files

qcow2: Fix DEBUG_* compilation



By introducing BlockDriverState compiling qcow2 with DEBUG_ALLOC and DEBUG_EXT
defined got broken.
Define a BdrvCheckResult structure locally which is now needed as the second
argument.

Also fix qcow2_read_extensions() needing BDRVQcowState.

Signed-off-by: default avatarPhilipp Hahn <hahn@univention.de>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 92196b2f
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -303,7 +303,10 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
    if (qcow2_write_snapshots(bs) < 0)
        goto fail;
#ifdef DEBUG_ALLOC
    qcow2_check_refcounts(bs);
    {
      BdrvCheckResult result = {0};
      qcow2_check_refcounts(bs, &result);
    }
#endif
    return 0;
 fail:
@@ -353,7 +356,10 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
        goto fail;

#ifdef DEBUG_ALLOC
    qcow2_check_refcounts(bs);
    {
        BdrvCheckResult result = {0};
        qcow2_check_refcounts(bs, &result);
    }
#endif
    return 0;
 fail:
@@ -390,7 +396,10 @@ int qcow2_snapshot_delete(BlockDriverState *bs, const char *snapshot_id)
        return ret;
    }
#ifdef DEBUG_ALLOC
    qcow2_check_refcounts(bs);
    {
        BdrvCheckResult result = {0};
        qcow2_check_refcounts(bs, &result);
    }
#endif
    return 0;
}
+5 −1
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
    while (offset < end_offset) {

#ifdef DEBUG_EXT
        BDRVQcowState *s = bs->opaque;
        /* Sanity check */
        if (offset > s->cluster_size)
            printf("qcow2_read_extension: suspicious offset %lu\n", offset);
@@ -280,7 +281,10 @@ static int qcow2_open(BlockDriverState *bs, int flags)
    qemu_co_mutex_init(&s->lock);

#ifdef DEBUG_ALLOC
    qcow2_check_refcounts(bs);
    {
        BdrvCheckResult result = {0};
        qcow2_check_refcounts(bs, &result);
    }
#endif
    return ret;