mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
block/snapshot: dirty all dirty bitmaps on snapshot-switch
Snapshot-switch actually changes active state of disk so it should reflect on dirty bitmaps. Otherwise next incremental backup using these bitmaps will be invalid. Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> Message-id: [email protected] Reviewed-by: Eric Blake <[email protected]> Reviewed-by: John Snow <[email protected]> Signed-off-by: Max Reitz <[email protected]>
This commit is contained in:
1 parent
bcb5270c75
commit
04dec3c3ae
1 file changed
+14
@@ -181,10 +181,24 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
int ret, open_ret;
|
||||
int64_t len;
|
||||
|
||||
if (!drv) {
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
len = bdrv_getlength(bs);
|
||||
if (len < 0) {
|
||||
return len;
|
||||
}
|
||||
/* We should set all bits in all enabled dirty bitmaps, because dirty
|
||||
* bitmaps reflect active state of disk and snapshot switch operation
|
||||
* actually dirties active state.
|
||||
* TODO: It may make sense not to set all bits but analyze block status of
|
||||
* current state and destination snapshot and do not set bits corresponding
|
||||
* to both-zero or both-unallocated areas. */
|
||||
bdrv_set_dirty(bs, 0, len);
|
||||
|
||||
if (drv->bdrv_snapshot_goto) {
|
||||
return drv->bdrv_snapshot_goto(bs, snapshot_id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user