• Max Reitz's avatar
    qcow2: Optimize bdrv_make_empty() · 94054183
    Max Reitz authored
    bdrv_make_empty() is currently only called if the current image
    represents an external snapshot that has been committed to its base
    image; it is therefore unlikely to have internal snapshots. In this
    case, bdrv_make_empty() can be greatly sped up by emptying the L1 and
    refcount table (while having the dirty flag set, which only works for
    compat=1.1) and creating a trivial refcount structure.
    If there are snapshots or for compat=0.10, fall back to the simple
    implementation (discard all clusters).
    [Applied s/clusters/cluster/ typo fix suggested by Eric Blake
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-id: 1414159063-25977-4-git-send-email-mreitz@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
blkdebug.c 24.4 KB