qcow2: autoloading dirty bitmaps

Auto loading bitmaps are bitmaps in Qcow2, with the AUTO flag set. They
are loaded when the image is opened and become BdrvDirtyBitmaps for the
corresponding drive.

Extra data in bitmaps is not supported for now.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20170628120530.31251-12-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2017-06-28 15:05:11 +03:00 committed by Max Reitz
parent d6883bc968
commit d1258dd0c8
3 changed files with 406 additions and 2 deletions

View file

@ -1445,9 +1445,22 @@ static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
/* Clear unknown autoclear feature bits */
update_header |= s->autoclear_features & ~QCOW2_AUTOCLEAR_MASK;
if (update_header && !bs->read_only && !(flags & BDRV_O_INACTIVE)) {
update_header =
update_header && !bs->read_only && !(flags & BDRV_O_INACTIVE);
if (update_header) {
s->autoclear_features &= QCOW2_AUTOCLEAR_MASK;
}
if (qcow2_load_autoloading_dirty_bitmaps(bs, &local_err)) {
update_header = false;
}
if (local_err != NULL) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
}
if (update_header) {
ret = qcow2_update_header(bs);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not update qcow2 header");