aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-bitmap.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2018-03-20 20:05:18 +0300
committerMax Reitz <mreitz@redhat.com>2018-03-26 21:17:24 +0200
commitb1336cc2ec87a6593e1167af6e5b2cbd3d31acac (patch)
tree03086036ce3f1c9f296cb0b32439267a39e99281 /block/qcow2-bitmap.c
parent7b93d78a04aa242d377ae213b79db6c319c71847 (diff)
downloadqemu-b1336cc2ec87a6593e1167af6e5b2cbd3d31acac.zip
qemu-b1336cc2ec87a6593e1167af6e5b2cbd3d31acac.tar.gz
qemu-b1336cc2ec87a6593e1167af6e5b2cbd3d31acac.tar.bz2
qcow2-bitmap: add qcow2_reopen_bitmaps_rw_hint()
Add version of qcow2_reopen_bitmaps_rw, which do the same work but also return a hint about was header updated or not. This will be used in the following fix for bitmaps reloading after migration. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 20180320170521.32152-2-vsementsov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qcow2-bitmap.c')
-rw-r--r--block/qcow2-bitmap.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 3010adb..6e93ec4 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -1004,7 +1004,8 @@ fail:
return false;
}
-int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp)
+int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated,
+ Error **errp)
{
BDRVQcow2State *s = bs->opaque;
Qcow2BitmapList *bm_list;
@@ -1012,6 +1013,10 @@ int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp)
GSList *ro_dirty_bitmaps = NULL;
int ret = 0;
+ if (header_updated != NULL) {
+ *header_updated = false;
+ }
+
if (s->nb_bitmaps == 0) {
/* No bitmaps - nothing to do */
return 0;
@@ -1055,6 +1060,9 @@ int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp)
error_setg_errno(errp, -ret, "Can't update bitmap directory");
goto out;
}
+ if (header_updated != NULL) {
+ *header_updated = true;
+ }
g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
}
@@ -1065,6 +1073,11 @@ out:
return ret;
}
+int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp)
+{
+ return qcow2_reopen_bitmaps_rw_hint(bs, NULL, errp);
+}
+
/* store_bitmap_data()
* Store bitmap to image, filling bitmap table accordingly.
*/